From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.0 tests=BAYES_00,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Aspect location in expression function. Date: Sat, 14 May 2022 17:40:03 +0200 Organization: Adalog Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 14 May 2022 15:40:03 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="17e2c70ee210ec3faf6bef81a9e783e0"; logging-data="25936"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bm5vrEMQ34B7bmpaAv/vX" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Cancel-Lock: sha1:ed7s7dWJOIm87sDpvyefaiGPxO8= In-Reply-To: Content-Language: fr Xref: reader02.eternal-september.org comp.lang.ada:63851 List-Id: Le 14/05/2022 à 13:47, Blady a écrit : > Hello, > > I'm puzzled when I want to changed a function body with aspects to an > expression function, for instance: > > function Length (S : Some_Tagged_Tyoe) return Natural >   with Pre => S.Valid >   is >   begin >   return S.Length; >   end; > > have to be changed in: > > function Length (S : Some_Tagged_Tyoe) return Natural >   is (S.Length) >   with Pre => S.Valid; > > The location of the aspect has moved to the end. > > I'd like simply replace the begin block by the expression, as: > > function Length (S : Some_Tagged_Tyoe) return Natural >   with Pre => S.Valid >   is (S.Length); > > What could be any reasons not to permit it? What you say is logical if you think of an expression function as a body; however, it is more like a specification (it can appear in a package spec, although it can complete a specification), so the place where the aspect appears makes sense. And it would be confusing to allow the aspect in two different places. It is the same for separate bodies of subprograms. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52 https://www.adalog.fr