From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,b14a804025dceb20 X-Google-Attributes: gid103376,public From: Francois Godme Subject: Re: Constructors/Destructors in Ada95 Date: 2000/10/25 Message-ID: <39F72564.D4C2E449@bigfoot.com>#1/1 X-Deja-AN: 685766489 Content-Transfer-Encoding: 8bit References: <39EE160D.F0A2000@bigfoot.com> <39EF5431.BF4CD793@bigfoot.com> <39F0A6C7.E592AFFB@averstar.com> <39F4AE95.4DB04145@bigfoot.com> X-Accept-Language: fr, en-US, en Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: abuse@proxad.net X-Trace: nnrp6.proxad.net 972498113 212.27.45.117 (Wed, 25 Oct 2000 20:21:53 CEST) Organization: Guest of ProXad - France MIME-Version: 1.0 NNTP-Posting-Date: Wed, 25 Oct 2000 20:21:53 CEST Newsgroups: comp.lang.ada Date: 2000-10-25T00:00:00+00:00 List-Id: Ray Blaak a �crit : > > I really would like to be able to do: > > procedure ":="(target : in out T; source : in T); > > so as to have complete control over what is happening. I vaguely recall some > rationale from the Ada 9X discussions for why user-defined assignment per se > was not incorporated. Does anyone remember? > An alternative would be inside Ada.Finalization procedure Deep_Copy (Source : access Controlled; Target : access Controlled); procedure Shallow_Copy (Source : in Controlled'Class; Target : out Controlled'Class); Deep_Copy is an overridible primitive whose default implementation is to call Shallow_Copy to copy Source into Target if Source and Target are different access values and to do nothing otherwise. Shallow_Copy is a class-wide procedure provided by the Ada run-time which avoids to fall into infinite recursion when writing "Target.all := Source.all;". Instead, one writes "Shallow_Copy (Source.all, Target.all);".