From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Aspect location in expression function.
Date: Sat, 14 May 2022 17:40:03 +0200 [thread overview]
Message-ID: <t5oigj$pag$1@dont-email.me> (raw)
In-Reply-To: <t5o4sg$3oh$1@gioia.aioe.org>
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
next prev parent reply other threads:[~2022-05-14 15:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-14 11:47 Aspect location in expression function Blady
2022-05-14 15:40 ` J-P. Rosen [this message]
2022-05-24 4:05 ` Randy Brukardt
2022-05-24 10:01 ` J-P. Rosen
2022-05-25 5:17 ` Randy Brukardt
2022-05-24 18:24 ` G.B.
2022-05-25 5:20 ` Randy Brukardt
2022-05-25 18:45 ` G.B.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox