From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: renames usage Date: Thu, 31 Dec 2020 19:48:43 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <5fedba8b$0$6186$426a74cc@news.free.fr> <5fedf478$0$21621$426a74cc@news.free.fr> NNTP-Posting-Host: 5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:60997 List-Id: 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. 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)); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de