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!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!cleanfeed1-b.proxad.net!nnrp1-1.free.fr!not-for-mail Subject: Re: renames usage Newsgroups: comp.lang.ada References: <5fedba8b$0$6186$426a74cc@news.free.fr> <3f5ff494-837e-446f-a621-ff1dd8414ea0n@googlegroups.com> From: DrPi <314@drpi.fr> Date: Thu, 31 Dec 2020 14:31:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <3f5ff494-837e-446f-a621-ff1dd8414ea0n@googlegroups.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Message-ID: <5fedd2cd$0$21616$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 31 Dec 2020 14:31:57 CET NNTP-Posting-Host: 82.65.30.55 X-Trace: 1609421517 news-3.free.fr 21616 82.65.30.55:54085 X-Complaints-To: abuse@proxad.net Xref: reader02.eternal-september.org comp.lang.ada:60991 List-Id: Le 31/12/2020 à 13:10, John Perry a écrit : > No. Assignment copies the object, and changes to the copy don't affect the original, while renaming obtains a reference to the object. This program will illustrate it: > > with Ada.Text_IO; use Ada.Text_IO; > > procedure Test_Renames is > > S: String := "hello world"; > T: String := S; > U: String renames S; > > begin > > Put_Line(S); > > T(T'First) := 'y'; > Put_Line(S); -- still "hello world" > > U(U'First) := 'y'; > Put_Line(S); -- "yello world" > > end Test_Renames; > Understood. Thanks.