From: DrPi <314@drpi.fr>
Subject: Re: renames usage
Date: Thu, 31 Dec 2020 14:31:55 +0100 [thread overview]
Message-ID: <5fedd2cd$0$21616$426a74cc@news.free.fr> (raw)
In-Reply-To: <3f5ff494-837e-446f-a621-ff1dd8414ea0n@googlegroups.com>
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.
next prev parent reply other threads:[~2020-12-31 13:31 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 [this message]
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
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