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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,70414f56d810c10c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.6.6 with SMTP id w6mr2344509pbw.33.1316517477780; Tue, 20 Sep 2011 04:17:57 -0700 (PDT) Path: lh7ni1077pbb.0!nntp.google.com!news1.google.com!postnews.google.com!a7g2000yqb.googlegroups.com!not-for-mail From: AdaMagica Newsgroups: comp.lang.ada Subject: Re: discriminant questions Date: Tue, 20 Sep 2011 04:11:32 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <9f37b726-d80b-4d24-bf3f-28a14255f7fd@s20g2000yql.googlegroups.com> <86015926-d652-4265-aedd-413312d399f9@dq7g2000vbb.googlegroups.com> <0d272f62-67d0-4905-972c-8a7e912c5531@en1g2000vbb.googlegroups.com> <148cxoyabima2.16mz6xwdph2hj.dlg@40tude.net> <1b7pl1piwc3hl.7q9fyyq8h3m7.dlg@40tude.net> NNTP-Posting-Host: 80.156.44.178 Mime-Version: 1.0 X-Trace: posting.google.com 1316517477 19513 127.0.0.1 (20 Sep 2011 11:17:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 20 Sep 2011 11:17:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a7g2000yqb.googlegroups.com; posting-host=80.156.44.178; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESRCNK X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2,gzip(gfe) Xref: news1.google.com comp.lang.ada:18043 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-09-20T04:11:32-07:00 List-Id: On 20 Sep., 09:38, "Dmitry A. Kazakov" wrote: > On Mon, 19 Sep 2011 19:01:05 -0500, Randy Brukardt wrote: > > >>> type Reference_Type (Element : access Integer) is null record; > > > The "good reason" for using this construct (beyond the obvious one of being > > able to use the "implicit dereference" construct is one of lifetime. The > > access discriminant of this object has the same lifetime as the enclosing > > object; if that object is returned from a function, that is very short. > > That is why this cannot be used for smart pointers. For them the > relationship is exactly opposite: Element always outlive the pointer except > the last one. Excuse me, but that's nonsense. It is a very good reason to use this construct. See AdaCore Gem #107: http://www.adacore.com/2011/06/06/gem-107-preventing-deallocation-for-reference-counted-types/