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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5d4ade2fd8fd67c6 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!news2.euro.net!feeder.news-service.com!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Legit Warnings or not Date: Thu, 21 Jul 2011 16:39:32 +0200 Organization: cbb software GmbH Message-ID: <1rx6dwrxmc81p.eazb4fjqztox$.dlg@40tude.net> References: <531193e0-3305-4292-9ed8-0176226c1d00@x12g2000yql.googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news2.google.com comp.lang.ada:21237 Date: 2011-07-21T16:39:32+02:00 List-Id: On Thu, 21 Jul 2011 09:50:26 +0000 (UTC), Brian Drummond wrote: > Interesting. Do you mean they allocate a new object? New implementation of. > Then how do they handle the following declarations > X : aliased Warned_Person; > Y : access Warned_Person := X'access; > when X.Name is resized? There exist approaches to this: 1. The varying component can allocated outside the object. The object would keep a reference to it. 2. The access types to the object can be fat pointers or indirect pointers. E.g. Y may actually point to a descriptor keeping a pointer to the object. 3. "aliased" can be disabled for roaming objects. 4. Certain types of access can be disabled, eventually allowing only downward closures of the object. Except for #1 aliasing is a problem: procedure Foo (X : in out Warned_Person; Y : Warned_Person) is begin X := ...; -- Changes the object Foo (X, X); -- Will Y be consistent in Foo? I think that Ada should not try to support this stuff. The proper way to handle this IMO is to allow the programmer to implement it himself by making the component "Name" a primitive operation (getter/setter). I don't know how close "aspects" are to this but this would be the right way. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de