comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Renaming primitives.
Date: Thu, 11 Jan 2024 21:59:05 -0600	[thread overview]
Message-ID: <unqdci$3bdol$1@dont-email.me> (raw)
In-Reply-To: unoep3$2uqo6$2@dont-email.me

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2158 bytes --]

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


  reply	other threads:[~2024-01-12  3:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 10:37 Renaming primitives Blady
2024-01-10 11:38 ` Jeffrey R.Carter
2024-01-11 10:06   ` Blady
2024-01-11 11:06     ` Jeffrey R.Carter
2024-01-10 12:13 ` Dmitry A. Kazakov
2024-01-11  2:09   ` Randy Brukardt
2024-01-11  2:18 ` Randy Brukardt
2024-01-11 10:09   ` Blady
2024-01-12  3:59     ` Randy Brukardt [this message]
2024-01-12  9:47       ` J-P. Rosen
2024-01-12 23:36         ` Lawrence D'Oliveiro
2024-01-12 10:29       ` Blady
2024-01-12 10:42     ` Blady
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox