comp.lang.ada
 help / color / mirror / Atom feed
From: DrPi <314@drpi.fr>
Subject: Re: renames usage
Date: Fri, 1 Jan 2021 13:39:39 +0100	[thread overview]
Message-ID: <5fef180c$0$19476$426a74cc@news.free.fr> (raw)
In-Reply-To: <rsl6e7$1iel$1@gioia.aioe.org>

Le 31/12/2020 à 19:48, Dmitry A. Kazakov a écrit :
> On 2020-12-31 16:55, DrPi wrote:
>> Le 31/12/2020 à 15:49, Jeffrey R. Carter a écrit :
>>> On 12/31/20 12:48 PM, DrPi wrote:
>>>>
>>>> Tag   : String renames Elements.Get_Tag_Name (Child);
>>>>
>>>> Is it equivalent to the following line ?
>>>>
>>>> Tag   : String := Elements.Get_Tag_Name (Child);
>>>
>>> No. A function result is a constant, so the 1st version gives you a 
>>> constant. The second gives you a variable with the same value.
>>>
>> Good to know.
>> What disturbed me was the function call associated with "renames".
> 
> Renaming a call to a function does not rename it in some 
> functional-programming manner. It renames only the result of.
> 
That's what I've understood with Jeffrey's answer.

> So if you do
> 
>     X : Float renames Random (Seed);
>     Y : array (1..10) of Float := (others => X);
> 
> That would not give you ten pseudo-random numbers. But this will:
> 
>     Z : array (1..10) of Float := (others => Random (Seed));
> 
Thanks for your detailed answer.


Reading all the answers, I understand that :
     X : Float renames Random (Seed);
is equivalent to :
     X : constant Float := Random (Seed);

Right ?

  reply	other threads:[~2021-01-01 12:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31 11:48 renames usage DrPi
2020-12-31 12:10 ` John Perry
2020-12-31 13:31   ` DrPi
2020-12-31 12:33 ` Gautier write-only address
2020-12-31 14:49 ` Jeffrey R. Carter
2020-12-31 15:55   ` DrPi
2020-12-31 18:48     ` Dmitry A. Kazakov
2021-01-01 12:39       ` DrPi [this message]
2021-01-01 13:20         ` Dmitry A. Kazakov
2021-01-02 11:53           ` DrPi
2021-01-01 14:46         ` Jeffrey R. Carter
2021-01-02 11:55           ` DrPi
2021-01-03  3:19           ` Randy Brukardt
2021-01-03 10:05             ` Jeffrey R. Carter
2021-01-06  2:49               ` Randy Brukardt
2021-01-02 16:00         ` G.B.
2021-01-02 17:22           ` Simon Wright
replies disabled

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