Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

You had mail. Paul read it, so ask him what it said.


devel / comp.lang.ada / Re: Renaming primitives.

SubjectAuthor
* Renaming primitives.Blady
+* Re: Renaming primitives.Jeffrey R.Carter
|`* Re: Renaming primitives.Blady
| `- Re: Renaming primitives.Jeffrey R.Carter
+* Re: Renaming primitives.Dmitry A. Kazakov
|`- Re: Renaming primitives.Randy Brukardt
`* Re: Renaming primitives.Randy Brukardt
 `* Re: Renaming primitives.Blady
  +* Re: Renaming primitives.Randy Brukardt
  |+* Re: Renaming primitives.J-P. Rosen
  ||`- Re: Renaming primitives.Lawrence D'Oliveiro
  |`- Re: Renaming primitives.Blady
  `- Re: Renaming primitives.Blady

1
Renaming primitives.

<unls1j$2f0up$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: p.p11@orange.fr (Blady)
Newsgroups: comp.lang.ada
Subject: Renaming primitives.
Date: Wed, 10 Jan 2024 11:37:39 +0100
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <unls1j$2f0up$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 10 Jan 2024 10:37:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5a50a221da06eb55dc22adad43acb4c5";
logging-data="2589657"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1CaNwJmpAI7xj8dRokrnH"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:adKmvt+rHAxOG62ahq6RXnipnb8=
Content-Language: fr, en-US
 by: Blady - Wed, 10 Jan 2024 10:37 UTC

Hello,

Is a procedure renaming equivalent to a simple call?
For instance:
procedure Log (Msg : String) is
begin
Ada.Text_IO.Put_Line (Msg);
end Log;
procedure My_Log_1 (Msg : String) is
begin
Log (Msg);
end My_Log_1;
procedure My_Log_2 (Msg : String) renames Log;

Almost, My_Log_1 is equivalent to My_Log_2, isn't it?

Is it the same with primitives?

For instance:
package Loggings is
type Logging is tagged record
Output : Ada.Text_IO.File_Access;
end record;
procedure Log (Handler : Logging; Msg : String);
end Loggings;
My_Handler : aliased Loggings.Logging := (Output =>
Ada.Text_IO.Current_Output);
My_Generic_Handler : access Loggings.Logging'Class := My_Handler'Access;
procedure My_Log_3 (Msg : String) renames My_Generic_Handler.Log;

To my surprise (well I hoped) My_Log_3 is compiled by GNAT.
Is it conformed to the Ada standard?

What is happening if My_Generic_Handler change?

For instance:
type Full_Logging is new Logging with null record;
procedure Log (Handler : Full_Logging; Msg : String);
....
My_Full_Handler : aliased Loggings.Full_Logging := (Output =>
Ada.Text_IO.Current_Output);
....
My_Generic_Handler := My_Full_Handler'Access;

Well, logically (?), My_Log_3 follows the change and outputs with
Full_Logging.

Unfortunately, GNAT claims renaming with several parameters.
I add:
procedure Log (Handler : Logging; Msg : String; Err : Natural);
....
procedure My_Log_4 (Msg : String; Err : Natural) renames
My_Generic_Handler.Log;

I got:
test_20240110_renproc.adb:47:14: error: too many arguments in call to "log"

Is it a correct or a GNAT issue?

Full source code on demand.

Thanks.
Happy New Year to all!
Pascal.

Re: Renaming primitives.

<unlvjh$2f36g$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Wed, 10 Jan 2024 12:38:25 +0100
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <unlvjh$2f36g$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Jan 2024 11:38:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9f8a5ac2dea7306d78f02eb3adb3b506";
logging-data="2591952"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//B0v2HHmYMyPg+UDETESSO+UHoDHhtt4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:t6BVDBD4hLExuUdgUgY6gew6OCM=
Content-Language: en-US
In-Reply-To: <unls1j$2f0up$3@dont-email.me>
 by: Jeffrey R.Carter - Wed, 10 Jan 2024 11:38 UTC

On 2024-01-10 11:37, Blady wrote:
>
>    package Loggings is
>       type Logging is tagged record
>          Output : Ada.Text_IO.File_Access;
>       end record;
>       procedure Log (Handler : Logging; Msg : String);
>    end Loggings;
>    My_Handler : aliased Loggings.Logging := (Output => Ada.Text_IO.Current_Output);
>    My_Generic_Handler : access Loggings.Logging'Class := My_Handler'Access;
>    procedure My_Log_3 (Msg : String) renames My_Generic_Handler.Log;

My_Generic_Handler.Log is shorthand for My_Generic_Handler.all.Log. According to
AARM 8.5.4(5.e/5) (http://www.ada-auth.org/standards/22aarm/html/AA-8-5-4.html),
the renaming also renames the prefixing object and passes it to calls to the
renamed subprogram: "The prefix in such a case is essentially renamed and passed
to any calls of the renamed subprogram."

So if I understand this correctly the renaming is roughly equivalent to

<anonymous> : Loggings.Logging renames My_Generic_Handler.all;
procedure My_Log_3 (Handler : Loggings.Logging := <anonymous>; Msg : String)
renames Loggings.Logging.Log;

except that My_Log_3 is called with only a String parameter even when using
positional notation.

Another way to look at it is that

My_Log_3 ("msg");

is implemented as

<anonymous>.Log (Msg => "msg");

> What is happening if My_Generic_Handler change?
>
>       type Full_Logging is new Logging with null record;
>       procedure Log (Handler : Full_Logging; Msg : String);
> ...
>    My_Full_Handler : aliased Loggings.Full_Logging := (Output =>
> Ada.Text_IO.Current_Output);
> ...
>    My_Generic_Handler := My_Full_Handler'Access;
>
> Well, logically (?), My_Log_3 follows the change and outputs with Full_Logging.

No, My_Log_3 continues to call Log with My_Handler as the object, IIUC.

> Unfortunately, GNAT claims renaming with several parameters.
> I add:
>       procedure Log (Handler : Logging; Msg : String; Err : Natural);
> ...
>    procedure My_Log_4 (Msg : String; Err : Natural) renames
> My_Generic_Handler.Log;
>
> I got:
> test_20240110_renproc.adb:47:14: error: too many arguments in call to "log"
>
> Is it a correct or a GNAT issue?

I'm not sure what is going on here. This looks correct to me.

--
Jeff Carter
"Fundamental improvements in performance
are most often made by algorithm changes,
not by tuning."
Elements of Programming Style
201

Re: Renaming primitives.

<unm1m6$2ftcd$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Wed, 10 Jan 2024 13:13:59 +0100
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <unm1m6$2ftcd$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Jan 2024 12:13:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3ec672b6e3be53c27e243d9bd8b20266";
logging-data="2618765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ZGrQcQbOERYqi2Qrqdu95ODkhGmkftU4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:1d1HNsPRF8B/1M1bATq/w1yOwLE=
Content-Language: en-US
In-Reply-To: <unls1j$2f0up$3@dont-email.me>
 by: Dmitry A. Kazakov - Wed, 10 Jan 2024 12:13 UTC

On 2024-01-10 11:37, Blady wrote:

> Is a procedure renaming equivalent to a simple call?
> For instance:
>    procedure Log (Msg : String) is
>    begin
>       Ada.Text_IO.Put_Line (Msg);
>    end Log;
>    procedure My_Log_1 (Msg : String) is
>    begin
>       Log (Msg);
>    end My_Log_1;
>    procedure My_Log_2 (Msg : String) renames Log;
>
> Almost, My_Log_1 is equivalent to My_Log_2, isn't it?
>
> Is it the same with primitives?
>
> For instance:
>    package Loggings is
>       type Logging is tagged record
>          Output : Ada.Text_IO.File_Access;
>       end record;
>       procedure Log (Handler : Logging; Msg : String);
>    end Loggings;
>    My_Handler : aliased Loggings.Logging := (Output =>
> Ada.Text_IO.Current_Output);
>    My_Generic_Handler : access Loggings.Logging'Class :=
> My_Handler'Access;
>    procedure My_Log_3 (Msg : String) renames My_Generic_Handler.Log;
>
> To my surprise (well I hoped) My_Log_3 is compiled by GNAT.
> Is it conformed to the Ada standard?

This looks like a bug to me. ARM 8.5.4 (2/3) states that the right part
of "renames" must be a name of a callable entity. My_Generic_Handler.Log
is a procedure call which is not a callable entity name.

Renaming a callable result of a function call might be legal [and quite
funny].

Disclaimer. I am not a language lawyer.

P.S. Specialization of subprograms would be a nice feature, though.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Renaming primitives.

<unnikl$2nh4j$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Wed, 10 Jan 2024 20:09:57 -0600
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <unnikl$2nh4j$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me> <unm1m6$2ftcd$1@dont-email.me>
Injection-Date: Thu, 11 Jan 2024 02:09:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="398f6d5c4c9ff6cbffb6894e51b840a0";
logging-data="2868371"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/shwaBp9cGNIQYm1bi94ey6mge0KSfPn0="
Cancel-Lock: sha1:fvBa5vMmL94ghn3zGjHM+5uTW3A=
X-MSMail-Priority: Normal
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
 by: Randy Brukardt - Thu, 11 Jan 2024 02:09 UTC

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:unm1m6$2ftcd$1@dont-email.me...
> On 2024-01-10 11:37, Blady wrote:
....
>> To my surprise (well I hoped) My_Log_3 is compiled by GNAT.
>> Is it conformed to the Ada standard?
>
> This looks like a bug to me. ARM 8.5.4 (2/3) states that the right part of
> "renames" must be a name of a callable entity. My_Generic_Handler.Log is a
> procedure call which is not a callable entity name.

A "prefixed view" is indeed a view of a callable entity. For instance, you
can pass those as generic formal subprograms or rename them.

> Renaming a callable result of a function call might be legal [and quite
> funny].

I believe that is legal as well.

> Disclaimer. I am not a language lawyer.

I'll refrain from a pithy remark. ;-)

> P.S. Specialization of subprograms would be a nice feature, though.

And Ada has had a limited form of it since Ada 2005. Limited because you can
only eliminate the first parameter. (Of course, you can also eliminate the
first two parameters, and so on. But you can't eliminate the third
parameter, although you can default it and effectively eliminate from calls.
Note that a renaming can change the defaults used for a subprogram call.)

Randy.

Re: Renaming primitives.

<unnj4v$2nj5s$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Wed, 10 Jan 2024 20:18:39 -0600
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <unnj4v$2nj5s$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me>
Injection-Date: Thu, 11 Jan 2024 02:18:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="398f6d5c4c9ff6cbffb6894e51b840a0";
logging-data="2870460"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tLvSdnRB0XgqqiT/Go72bRqoCddk5AWY="
Cancel-Lock: sha1:Tmx8h3s9idx55qPRKPrLo706Yb0=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MSMail-Priority: Normal
X-RFC2646: Format=Flowed; Response
X-Priority: 3
 by: Randy Brukardt - Thu, 11 Jan 2024 02:18 UTC

"Blady" <p.p11@orange.fr> wrote in message
news:unls1j$2f0up$3@dont-email.me...
> Is a procedure renaming equivalent to a simple call?

General point: "Equivalent" is never true in programming language design. If
construct A is equivalent in every way to construct B, then they have to be
the same construct.

For instance, in your example below, the two subprogram declarations have
different identifiers which have different visibility (two declarations
cannot be at exactly the same place), so there is at least one way that
they're not equivalent.

So, if you want to talk about "equivalence", you need to qualify that by
what properties you are interested in.

....
> What is happening if My_Generic_Handler change?

Nothing. The names in a renaming are evaluated when the renaming is
declared. If there are parts that could change, the compiler has to save the
values at the point of the renaming. That's true for all forms of renaming
(some names, like package names, can't change meaning so the example isn't
possible, of course).

....
> I got:
> test_20240110_renproc.adb:47:14: error: too many arguments in call to
> "log"
>
> Is it a correct or a GNAT issue?

Looks like a bug to me. Not too surprising, though, this sort of thing is a
special case in a compiler and often added to pass an ACATS test or user bug
report. Such fixes can often not be fully general.

Randy.

Re: Renaming primitives.

<unoejn$2uqo6$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: p.p11@orange.fr (Blady)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Thu, 11 Jan 2024 11:06:45 +0100
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <unoejn$2uqo6$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me> <unlvjh$2f36g$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 11 Jan 2024 10:06:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3c51d50ffdb2a9483b64bc8ff7220ce6";
logging-data="3107590"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18iRy5drLnff1W0OI9i+vk5"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:A+pCaQsizfFIFtwGFlUD/Gm3ito=
In-Reply-To: <unlvjh$2f36g$1@dont-email.me>
Content-Language: fr, en-US
 by: Blady - Thu, 11 Jan 2024 10:06 UTC

Le 10/01/2024 à 12:38, Jeffrey R.Carter a écrit :
> On 2024-01-10 11:37, Blady wrote:
>>     procedure My_Log_3 (Msg : String) renames My_Generic_Handler.Log;
>
> My_Generic_Handler.Log is shorthand for My_Generic_Handler.all.Log.
> According to AARM 8.5.4(5.e/5)
> (http://www.ada-auth.org/standards/22aarm/html/AA-8-5-4.html), the
> renaming also renames the prefixing object and passes it to calls to the
> renamed subprogram: "The prefix in such a case is essentially renamed
> and passed to any calls of the renamed subprogram."
>
> So if I understand this correctly the renaming is roughly equivalent to
>
> <anonymous> : Loggings.Logging renames My_Generic_Handler.all;
> procedure My_Log_3 (Handler : Loggings.Logging := <anonymous>; Msg :
> String) renames Loggings.Logging.Log;
>
> except that My_Log_3 is called with only a String parameter even when
> using positional notation.
>
> Another way to look at it is that
>
>    My_Log_3 ("msg");
>
> is implemented as
>
>    <anonymous>.Log (Msg => "msg");

Thanks for your useful explanation.

> > What is happening if My_Generic_Handler change?
> >
>>        type Full_Logging is new Logging with null record;
>>        procedure Log (Handler : Full_Logging; Msg : String);
>> ...
>>     My_Full_Handler : aliased Loggings.Full_Logging := (Output =>
>> Ada.Text_IO.Current_Output);
>> ...
>>     My_Generic_Handler := My_Full_Handler'Access;
>>
>> Well, logically (?), My_Log_3 follows the change and outputs with
>> Full_Logging.
>
> No, My_Log_3 continues to call Log with My_Handler as the object, IIUC.

Yet, the code:
My_Log_3 ("Hei");
My_Generic_Handler := My_Full_Handler'Access;
My_Log_3 ("Hei");
gives:
Hei
Full Hei

I thought that was correct, wasn't it?

Pascal.

Re: Renaming primitives.

<unoep3$2uqo6$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!nntp.comgw.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: p.p11@orange.fr (Blady)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Thu, 11 Jan 2024 11:09:38 +0100
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <unoep3$2uqo6$2@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me> <unnj4v$2nj5s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 11 Jan 2024 10:09:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3c51d50ffdb2a9483b64bc8ff7220ce6";
logging-data="3107590"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qFKP0z9Z70Q6iFlTYCx9F"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Cidk63tARXqr7x2bbWhHky437j4=
In-Reply-To: <unnj4v$2nj5s$1@dont-email.me>
Content-Language: fr, en-US
 by: Blady - Thu, 11 Jan 2024 10:09 UTC

Le 11/01/2024 à 03:18, Randy Brukardt a écrit :
> "Blady" <p.p11@orange.fr> wrote in message
> news:unls1j$2f0up$3@dont-email.me...
>> Is a procedure renaming equivalent to a simple call?
>
> General point: "Equivalent" is never true in programming language design. If
> construct A is equivalent in every way to construct B, then they have to be
> the same construct.
>
> For instance, in your example below, the two subprogram declarations have
> different identifiers which have different visibility (two declarations
> cannot be at exactly the same place), so there is at least one way that
> they're not equivalent.
>
> So, if you want to talk about "equivalence", you need to qualify that by
> what properties you are interested in.

Well, I hadn't find a better word :-(

> ...
>> What is happening if My_Generic_Handler change?
>
> Nothing. The names in a renaming are evaluated when the renaming is
> declared. If there are parts that could change, the compiler has to save the
> values at the point of the renaming. That's true for all forms of renaming
> (some names, like package names, can't change meaning so the example isn't
> possible, of course).

Yet, the code:
My_Log_3 ("Hei");
My_Generic_Handler := My_Full_Handler'Access;
My_Log_3 ("Hei");
gives:
Hei
Full Hei

I thought that was correct, wasn't it?
GNAT issue ?

> ...
>> I got:
>> test_20240110_renproc.adb:47:14: error: too many arguments in call to
>> "log"
>>
>> Is it a correct or a GNAT issue?
>
> Looks like a bug to me. Not too surprising, though, this sort of thing is a
> special case in a compiler and often added to pass an ACATS test or user bug
> report. Such fixes can often not be fully general.

Thanks, I'll report it.

Pascal.

Re: Renaming primitives.

<unoi3j$2v80g$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Thu, 11 Jan 2024 12:06:27 +0100
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <unoi3j$2v80g$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me> <unlvjh$2f36g$1@dont-email.me>
<unoejn$2uqo6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 11 Jan 2024 11:06:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c28c0195b3708814fd928d5f77aad221";
logging-data="3121168"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+P3ChnGDv71MPMubVVfVkfPEO22Iqtb1Y="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:TubCiE1DdIF54xA5tFsNYEjVlXA=
Content-Language: en-US
In-Reply-To: <unoejn$2uqo6$1@dont-email.me>
 by: Jeffrey R.Carter - Thu, 11 Jan 2024 11:06 UTC

On 2024-01-11 11:06, Blady wrote:
>
> Yet, the code:
>    My_Log_3 ("Hei");
>    My_Generic_Handler := My_Full_Handler'Access;
>    My_Log_3 ("Hei");
> gives:
> Hei
> Full Hei
>
> I thought that was correct, wasn't it?

Not according to my understanding, and it seems according to Brukardt's
better-informed understanding.

--
Jeff Carter
"[A] brilliant military career that after thirty
years catapulted him to the rank of corporal."
Take the Money and Run
138

Re: Renaming primitives.

<unqdci$3bdol$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Thu, 11 Jan 2024 21:59:05 -0600
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <unqdci$3bdol$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me> <unnj4v$2nj5s$1@dont-email.me> <unoep3$2uqo6$2@dont-email.me>
Injection-Date: Fri, 12 Jan 2024 03:58:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d5b58a468fd464abf689d168c8d4cd14";
logging-data="3520277"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QhpgbzSTKcnZR4kiBnbllKCbbAmBLuTo="
Cancel-Lock: sha1:WPO/wiPwOsEExeXHYlxUMfYijrU=
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-MSMail-Priority: Normal
X-Priority: 3
X-RFC2646: Format=Flowed; Response
 by: Randy Brukardt - Fri, 12 Jan 2024 03:59 UTC

"Blady" <p.p11@orange.fr> wrote in message
news:unoep3$2uqo6$2@dont-email.me...
> Le 11/01/2024 � 03:18, Randy Brukardt a �crit :
>> "Blady" <p.p11@orange.fr> wrote in message
>> news:unls1j$2f0up$3@dont-email.me...
>>> Is a procedure renaming equivalent to a simple call?
>>
>> General point: "Equivalent" is never true in programming language design.
>> If
>> construct A is equivalent in every way to construct B, then they have to
>> be
>> the same construct.
>>
>> For instance, in your example below, the two subprogram declarations have
>> different identifiers which have different visibility (two declarations
>> cannot be at exactly the same place), so there is at least one way that
>> they're not equivalent.
>>
>> So, if you want to talk about "equivalence", you need to qualify that by
>> what properties you are interested in.
>
> Well, I hadn't find a better word :-(

You have to say something like "equivalent in run-time behavior";
"equivalent" by itself is always False.

>> ...
>>> What is happening if My_Generic_Handler change?
>>
>> Nothing. The names in a renaming are evaluated when the renaming is
>> declared. If there are parts that could change, the compiler has to save
>> the
>> values at the point of the renaming. That's true for all forms of
>> renaming
>> (some names, like package names, can't change meaning so the example
>> isn't
>> possible, of course).
>
> Yet, the code:
> My_Log_3 ("Hei");
> My_Generic_Handler := My_Full_Handler'Access;
> My_Log_3 ("Hei");
> gives:
> Hei
> Full Hei
>
> I thought that was correct, wasn't it?

Shouldn't be correct. The "name" is evaluated during a renaming, and the
renamed entity does not change afterwards. So whatever subprogram My_Log_3
designates for the first call should be the same for the second call.

> GNAT issue ?

Appears to be (of course, without seeing the full code I can't say
definitively; people here often post snippets that aren't quite the same as
the actual code they tried to run. I wouldn't expect that with you, but we
all make mistakes. :-).

Randy.

Re: Renaming primitives.

<unr1rt$3dmvf$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rosen@adalog.fr (J-P. Rosen)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Fri, 12 Jan 2024 05:47:41 -0400
Organization: Adalog
Lines: 17
Message-ID: <unr1rt$3dmvf$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me> <unnj4v$2nj5s$1@dont-email.me>
<unoep3$2uqo6$2@dont-email.me> <unqdci$3bdol$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 12 Jan 2024 09:47:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d8e379d233460a2a2bd53fe695002736";
logging-data="3595247"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19v+BSWU/VpDO36BeBh05JO"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:m/dAwhWEFjMhDCKqW/unKNGzKVU=
Content-Language: en-US, fr
In-Reply-To: <unqdci$3bdol$1@dont-email.me>
 by: J-P. Rosen - Fri, 12 Jan 2024 09:47 UTC

Le 11/01/2024 à 23:59, Randy Brukardt a écrit :
> Shouldn't be correct. The "name" is evaluated during a renaming, and the
> renamed entity does not change afterwards. So whatever subprogram My_Log_3
> designates for the first call should be the same for the second call.

Just to make things perfectly clear (I hope):
Renames shouldn't be seen as a kind of macro (i.e. textual substitution
of the LHS by the RHS). It is rather like evaluating the address of the
RHS thing, and storing it into the LHS. A kind of precalculated
address/pointer/reference.

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
https://www.adalog.fr https://www.adacontrol.fr

Re: Renaming primitives.

<unr4al$3e32r$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: p.p11@orange.fr (Blady)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Fri, 12 Jan 2024 11:29:40 +0100
Organization: A noiseless patient Spider
Lines: 66
Message-ID: <unr4al$3e32r$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me> <unnj4v$2nj5s$1@dont-email.me>
<unoep3$2uqo6$2@dont-email.me> <unqdci$3bdol$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 12 Jan 2024 10:29:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="dc21db9e1065c4542d0bf5ec17bc6141";
logging-data="3607643"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jM7o0roL4W/gnCNeKqAdv"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:1J3q/akuiO4rrnJTNRCOIC+hM1k=
In-Reply-To: <unqdci$3bdol$1@dont-email.me>
Content-Language: fr, en-US
 by: Blady - Fri, 12 Jan 2024 10:29 UTC

Le 12/01/2024 à 04:59, Randy Brukardt a écrit :
> "Blady" <p.p11@orange.fr> wrote in message
> news:unoep3$2uqo6$2@dont-email.me...
>> Le 11/01/2024 à 03:18, Randy Brukardt a écrit :
>>> "Blady" <p.p11@orange.fr> wrote in message
>>> news:unls1j$2f0up$3@dont-email.me...
>>>> Is a procedure renaming equivalent to a simple call?
>>>
>>> General point: "Equivalent" is never true in programming language design.
>>> If
>>> construct A is equivalent in every way to construct B, then they have to
>>> be
>>> the same construct.
>>>
>>> For instance, in your example below, the two subprogram declarations have
>>> different identifiers which have different visibility (two declarations
>>> cannot be at exactly the same place), so there is at least one way that
>>> they're not equivalent.
>>>
>>> So, if you want to talk about "equivalence", you need to qualify that by
>>> what properties you are interested in.
>>
>> Well, I hadn't find a better word :-(
>
> You have to say something like "equivalent in run-time behavior";
> "equivalent" by itself is always False.

Thanks, I like it.

>>> ...
>>>> What is happening if My_Generic_Handler change?
>>>
>>> Nothing. The names in a renaming are evaluated when the renaming is
>>> declared. If there are parts that could change, the compiler has to save
>>> the
>>> values at the point of the renaming. That's true for all forms of
>>> renaming
>>> (some names, like package names, can't change meaning so the example
>>> isn't
>>> possible, of course).
>>
>> Yet, the code:
>> My_Log_3 ("Hei");
>> My_Generic_Handler := My_Full_Handler'Access;
>> My_Log_3 ("Hei");
>> gives:
>> Hei
>> Full Hei
>>
>> I thought that was correct, wasn't it?
>
> Shouldn't be correct. The "name" is evaluated during a renaming, and the
> renamed entity does not change afterwards. So whatever subprogram My_Log_3
> designates for the first call should be the same for the second call.
>
>> GNAT issue ?
>
> Appears to be (of course, without seeing the full code I can't say
> definitively; people here often post snippets that aren't quite the same as
> the actual code they tried to run. I wouldn't expect that with you, but we
> all make mistakes. :-).

I quote you :-) and attached the full source code.
You might follow or comment on the created issue:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113350

Re: Renaming primitives.

<unr52b$3e32r$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: p.p11@orange.fr (Blady)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Fri, 12 Jan 2024 11:42:19 +0100
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <unr52b$3e32r$2@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me> <unnj4v$2nj5s$1@dont-email.me>
<unoep3$2uqo6$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 12 Jan 2024 10:42:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="dc21db9e1065c4542d0bf5ec17bc6141";
logging-data="3607643"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TG4xlg4agAEuJUK22Hax1"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:y9xIvEkNnnaZvdG0Q4VpH2j9qjI=
In-Reply-To: <unoep3$2uqo6$2@dont-email.me>
Content-Language: fr, en-US
 by: Blady - Fri, 12 Jan 2024 10:42 UTC

Le 11/01/2024 à 11:09, Blady a écrit :
> Le 11/01/2024 à 03:18, Randy Brukardt a écrit :
>> "Blady" <p.p11@orange.fr> wrote in message
>> news:unls1j$2f0up$3@dont-email.me...
>>> I got:
>>> test_20240110_renproc.adb:47:14: error: too many arguments in call to
>>> "log"
>>>
>>> Is it a correct or a GNAT issue?
>>
>> Looks like a bug to me. Not too surprising, though, this sort of thing
>> is a
>> special case in a compiler and often added to pass an ACATS test or
>> user bug
>> report. Such fixes can often not be fully general.
>
> Thanks, I'll report it.

Submitted issue with attached source code:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113351

Re: Renaming primitives.

<unsid7$3km8p$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.ada
Subject: Re: Renaming primitives.
Date: Fri, 12 Jan 2024 23:36:07 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <unsid7$3km8p$1@dont-email.me>
References: <unls1j$2f0up$3@dont-email.me> <unnj4v$2nj5s$1@dont-email.me>
<unoep3$2uqo6$2@dont-email.me> <unqdci$3bdol$1@dont-email.me>
<unr1rt$3dmvf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 12 Jan 2024 23:36:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d6f6e66fe00847a4ec7e9d8844058e91";
logging-data="3823897"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jThvB3XP8iYb9aw/F3Giv"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:BAq3yKW67MqjvC+pnAP5+4j2vGQ=
 by: Lawrence D'Oliv - Fri, 12 Jan 2024 23:36 UTC

On Fri, 12 Jan 2024 05:47:41 -0400, J-P. Rosen wrote:

> Renames shouldn't be seen as a kind of macro (i.e. textual substitution
> of the LHS by the RHS).

There is the wrong way of implementing macros--by textual substitution--
and there is the right way, as done in homoiconic languages such as Lisp.

For example, the latter can give you lexical binding. That is, the rename
still refers to the original definition, even in an inner scope where that
is masked by another entity with the same name. I assume that is how the
Ada mechanism works.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor