Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Loose bits sink chips.


devel / comp.lang.ada / Aspect location in expression function.

SubjectAuthor
* Aspect location in expression function.Blady
`* Re: Aspect location in expression function.J-P. Rosen
 `* Re: Aspect location in expression function.Randy Brukardt
  +* Re: Aspect location in expression function.J-P. Rosen
  |`- Re: Aspect location in expression function.Randy Brukardt
  `* Re: Aspect location in expression function.G.B.
   `* Re: Aspect location in expression function.Randy Brukardt
    `- Re: Aspect location in expression function.G.B.

1
Aspect location in expression function.

<t5o4sg$3oh$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6924&group=comp.lang.ada#6924

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!1GG1IDGiZkh/Pwsi/1OZHg.user.46.165.242.75.POSTED!not-for-mail
From: p.p...@orange.fr (Blady)
Newsgroups: comp.lang.ada
Subject: Aspect location in expression function.
Date: Sat, 14 May 2022 13:47:28 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t5o4sg$3oh$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="3857"; posting-host="1GG1IDGiZkh/Pwsi/1OZHg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.7.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Blady - Sat, 14 May 2022 11:47 UTC

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?

Thanks, Pascal.

Re: Aspect location in expression function.

<t5oigj$pag$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6928&group=comp.lang.ada#6928

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ros...@adalog.fr (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
Lines: 42
Message-ID: <t5oigj$pag$1@dont-email.me>
References: <t5o4sg$3oh$1@gioia.aioe.org>
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: <t5o4sg$3oh$1@gioia.aioe.org>
Content-Language: fr
 by: J-P. Rosen - Sat, 14 May 2022 15:40 UTC

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

Re: Aspect location in expression function.

<t6hlhq$vcu$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6944&group=comp.lang.ada#6944

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Aspect location in expression function.
Date: Mon, 23 May 2022 23:05:12 -0500
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <t6hlhq$vcu$1@dont-email.me>
References: <t5o4sg$3oh$1@gioia.aioe.org> <t5oigj$pag$1@dont-email.me>
Injection-Date: Tue, 24 May 2022 04:05:14 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="1a8d9be57c517cdc89f42c56a5fd1c0a";
logging-data="32158"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jorxq5V1JZTeuiMGw9zmYiAUt/Jwrows="
Cancel-Lock: sha1:dhQ7F+xvitRUF/AvCVJctCVq2pA=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-RFC2646: Format=Flowed; Response
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-Priority: 3
X-MSMail-Priority: Normal
 by: Randy Brukardt - Tue, 24 May 2022 04:05 UTC

"J-P. Rosen" <rosen@adalog.fr> wrote in message
news:t5oigj$pag$1@dont-email.me...
> 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.

To make a functioning :LR grammar for Ada, I *had* to allow the aspect
specification in both places, and then make one of them illegal. Which is
more work than just allowing in either place. So I guess it is a matter of
perspective. :-)

To the OP: we discussed placement of aspect specifications ad-nausem, as
issues like this always were coming up. There is no consistent rule that
really works well, because one does not want small things following large
sets of aspect specs -- they can get lost and overlooked.

For instance, one puts aspect specifications after "is abstract" as
otherwise that could be lost after a lengthy precondition expression (and
it's too important to be lost). See how that could happen in the following
(illegal) declaration:

procedure P (A, B ,,,)
with Pre => <very long expression that extends over several lines
here>
is abstract;

So something like this (and "is null" as well) require the Pre at the end:

procedure P (A, B ,,,)
is abstract
with Pre => <very long expression that extends over several lines
here>;

Expression functions generally follow the same rules as the older null
procedures, thus they ended up with the same positioning. It's not as
obvious a case here, since the return expression can also be long, but we
thought it should be consistent.

BTW, I don't think there ever is a reason to go from an expression with a
normal body to an expression function (assuming the body is legal). A normal
body is more readable and less of a hassle during maintenance. The advantage
of an expression function is to use it in places where a regular body is not
allowed and/or just to be lazy writing the body - neither of which would
ever require changing *to* an expression function. Maintenance might require
changing *from* an expression function if the body has gotten too complex
(for instance, needs a variable declaration), but that generally will
require moving the function as well so "ease" of doing so isn't very
relevant.

Randy.

Re: Aspect location in expression function.

<t6iad4$263$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6946&group=comp.lang.ada#6946

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ros...@adalog.fr (J-P. Rosen)
Newsgroups: comp.lang.ada
Subject: Re: Aspect location in expression function.
Date: Tue, 24 May 2022 12:01:08 +0200
Organization: Adalog
Lines: 16
Message-ID: <t6iad4$263$1@dont-email.me>
References: <t5o4sg$3oh$1@gioia.aioe.org> <t5oigj$pag$1@dont-email.me>
<t6hlhq$vcu$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 24 May 2022 10:01:08 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="c1fb8460b4a1dfa88e5e892872e3df47";
logging-data="2243"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AmYQgYVbCG/ue+3ebm5GS"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:bXJmdxQqW6/BGBME0lBFGiZeAmA=
In-Reply-To: <t6hlhq$vcu$1@dont-email.me>
Content-Language: fr
 by: J-P. Rosen - Tue, 24 May 2022 10:01 UTC

Le 24/05/2022 à 06:05, Randy Brukardt a écrit :
> To make a functioning :LR grammar for Ada, I*had* to allow the aspect
> specification in both places, and then make one of them illegal. Which is
> more work than just allowing in either place. So I guess it is a matter of
> perspective.:-)

But if you allow it in either place, then you have to decide what
happens if it appears in /both/ places... Would you like conformance
checking? I bet no ;-)

--
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

Re: Aspect location in expression function.

<t6j7se$8b1$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6947&group=comp.lang.ada#6947

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bauh...@notmyhomepage.invalid (G.B.)
Newsgroups: comp.lang.ada
Subject: Re: Aspect location in expression function.
Date: Tue, 24 May 2022 20:24:14 +0200
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <t6j7se$8b1$1@dont-email.me>
References: <t5o4sg$3oh$1@gioia.aioe.org> <t5oigj$pag$1@dont-email.me>
<t6hlhq$vcu$1@dont-email.me>
Reply-To: nonlegitur@notmyhomepage.de
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 24 May 2022 18:24:14 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e9567c2acf92667a646d66bd8db45cd8";
logging-data="8545"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3lX1efDTeT3o87X48UnXTFFO68YtFUE8="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.9.0
Cancel-Lock: sha1:MLFRNahva0uy4miAHtw9V5s/W/o=
In-Reply-To: <t6hlhq$vcu$1@dont-email.me>
Content-Language: en-US
 by: G.B. - Tue, 24 May 2022 18:24 UTC

On 24.05.22 06:05, Randy Brukardt wrote:

> To the OP: we discussed placement of aspect specifications ad-nausem, as
> issues like this always were coming up. There is no consistent rule that
> really works well, because one does not want small things following large
> sets of aspect specs -- they can get lost and overlooked.
>
> For instance, one puts aspect specifications after "is abstract" as
> otherwise that could be lost after a lengthy precondition expression (and
> it's too important to be lost).

Isn't this emphasis on "is abstract" loosing the very point of abstraction?

> See how that could happen in the following
> (illegal) declaration:
>
> procedure P (A, B ,,,)
> with Pre => <very long expression that extends over several lines
> here>
> is abstract;

Who cares to see "is abstract" if P is in a spec?
The implementer, I guess, but the client? Less so.

Re: Aspect location in expression function.

<t6ke5a$moi$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6948&group=comp.lang.ada#6948

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Aspect location in expression function.
Date: Wed, 25 May 2022 00:17:28 -0500
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <t6ke5a$moi$1@dont-email.me>
References: <t5o4sg$3oh$1@gioia.aioe.org> <t5oigj$pag$1@dont-email.me> <t6hlhq$vcu$1@dont-email.me> <t6iad4$263$1@dont-email.me>
Injection-Date: Wed, 25 May 2022 05:17:30 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="806c3b021b8ce33d20fe67da3968fc86";
logging-data="23314"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19r/dEFGMtQwLlLTiub6R0I18gtjQhf1oY="
Cancel-Lock: sha1:Uc4eaPWZJ1BXIGGEAz2r+/6V9NQ=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-RFC2646: Format=Flowed; Response
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-Priority: 3
X-MSMail-Priority: Normal
 by: Randy Brukardt - Wed, 25 May 2022 05:17 UTC

"J-P. Rosen" <rosen@adalog.fr> wrote in message
news:t6iad4$263$1@dont-email.me...
> Le 24/05/2022 � 06:05, Randy Brukardt a �crit :
>> To make a functioning :LR grammar for Ada, I*had* to allow the aspect
>> specification in both places, and then make one of them illegal. Which is
>> more work than just allowing in either place. So I guess it is a matter
>> of
>> perspective.:-)
>
> But if you allow it in either place, then you have to decide what happens
> if it appears in /both/ places... Would you like conformance checking? I
> bet no ;-)

An individual aspect can only be specified once per entity, so specifying it
in both is obviously illegal. One would have to check the exact wording to
ensure that it really said that, but surely that would be the intent.

Randy.

Re: Aspect location in expression function.

<t6kebj$npp$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6949&group=comp.lang.ada#6949

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Aspect location in expression function.
Date: Wed, 25 May 2022 00:20:50 -0500
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <t6kebj$npp$1@dont-email.me>
References: <t5o4sg$3oh$1@gioia.aioe.org> <t5oigj$pag$1@dont-email.me> <t6hlhq$vcu$1@dont-email.me> <t6j7se$8b1$1@dont-email.me>
Injection-Date: Wed, 25 May 2022 05:20:51 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="806c3b021b8ce33d20fe67da3968fc86";
logging-data="24377"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186gWaWrgPs43c4fi4oG9ufRIYup96O7L0="
Cancel-Lock: sha1:iS/n+WqAd7H6uT5b0v+qhw9vcx0=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-RFC2646: Format=Flowed; Response
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-Priority: 3
X-MSMail-Priority: Normal
 by: Randy Brukardt - Wed, 25 May 2022 05:20 UTC

"G.B." <bauhaus@notmyhomepage.invalid> wrote in message
news:t6j7se$8b1$1@dont-email.me...
> On 24.05.22 06:05, Randy Brukardt wrote:
....
> Who cares to see "is abstract" if P is in a spec?
> The implementer, I guess, but the client? Less so.

Any client that needs to declare an extension (pretty common in OOP),
especially as "abstract" routines mostly are used with root types (and
interfaces). I suppose you could "program by error" and just let the
compiler complain if you don't give a body for something abstract, but it's
generally recommended to know what you're doing and not just try to make the
compiler happy.

Randy.

Re: Aspect location in expression function.

<t6lth7$6qd$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6951&group=comp.lang.ada#6951

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bauh...@notmyhomepage.invalid (G.B.)
Newsgroups: comp.lang.ada
Subject: Re: Aspect location in expression function.
Date: Wed, 25 May 2022 20:45:58 +0200
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <t6lth7$6qd$1@dont-email.me>
References: <t5o4sg$3oh$1@gioia.aioe.org> <t5oigj$pag$1@dont-email.me>
<t6hlhq$vcu$1@dont-email.me> <t6j7se$8b1$1@dont-email.me>
<t6kebj$npp$1@dont-email.me>
Reply-To: nonlegitur@notmyhomepage.de
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 25 May 2022 18:45:59 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="017c812674dc9e0868f526812d050bfb";
logging-data="6989"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19u/LYlUr+TF0zQppZnIvvGAlZ0Bzxifzg="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.9.1
Cancel-Lock: sha1:7mwdUJhbw7ActNOdePyPd9/wuKI=
In-Reply-To: <t6kebj$npp$1@dont-email.me>
Content-Language: en-US
 by: G.B. - Wed, 25 May 2022 18:45 UTC

On 25.05.22 07:20, Randy Brukardt wrote:
> "G.B." <bauhaus@notmyhomepage.invalid> wrote in message
> news:t6j7se$8b1$1@dont-email.me...
>> On 24.05.22 06:05, Randy Brukardt wrote:
> ...
>> Who cares to see "is abstract" if P is in a spec?
>> The implementer, I guess, but the client? Less so.
>
> Any client that needs to declare an extension (pretty common in OOP),

Another, dare I say, more frequent way of being a client of a type
is being a caller of the type's subprograms, such as P, rather than
being an implementer of a type's concrete behavior. (The two can
overlap, but I'm thinking of the more frequent human clients here :) )

A case I'd single out is a type that comes with a factory F.
I'd expect the associated type T to be abstract. This goes
without saying! ;-) A client needs to know the "behavioral"
interface of T and also that of F.
The "is abstract" then remains as helpful language technology,
but as seen inside the factory.

(So, I'd put "is abstract" last.)

> especially as "abstract" routines mostly are used with root types (and
> interfaces). I suppose you could "program by error"

Not design errors, but mechanical errors duly output by the compiler.
The programmer will be programming by "following the language's rules".
IDEs and compilers will assist the programmer who is implementing
an abstract type. For example, the usual IDE has this suggestion
following its compiler's error message::

Fix: "Add unimplemented methods"
(for)
Error: "The type must implement[!] the inherited abstract method ..."

The IDE will do so if you answer "Yes" and programmers can provide their
own adjustments to template text that this mechanism will be using. Thus,
again, programmers can involve useful language technology in
a template's text. I remember some Ada tools offering similar features.

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor