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 Received: by 10.68.13.201 with SMTP id j9mr2092835pbc.23.1316521992878; Tue, 20 Sep 2011 05:33:12 -0700 (PDT) Path: lh7ni1111pbb.0!nntp.google.com!news1.google.com!postnews.google.com!hb5g2000vbb.googlegroups.com!not-for-mail From: AdaMagica Newsgroups: comp.lang.ada Subject: Re: discriminant questions Date: Tue, 20 Sep 2011 05:31:34 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3d49749a-1da5-49b9-bc68-5d9befb4ed62@hb5g2000vbb.googlegroups.com> 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 1316521992 1818 127.0.0.1 (20 Sep 2011 12:33:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 20 Sep 2011 12:33:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: hb5g2000vbb.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:18045 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-09-20T05:31:34-07:00 List-Id: > The example just confirms what I said: > > =A0 =A0type Smart_Pointer is private; =A0-- No discriminants! OK, I misunderstood > It uses access discriminant for the *accessor* kludge, which is an absolu= te > different story (described by Randy): a short-living reference. > > P.S. I also see little or no point in using "accessors". Primitive > operations Set and Get would be as good/bad. No, here it's you who misunderstands. Get is still present and returns an accessor instead of an access type and thus makes accesses safe (no way to deallocate the accessed object). And Get *is* primitive. And with reference types and objects in Ada 2012, there is no more need for explicit dereference: Get (P).Data simply becomes Get (P), i.e. it is overloaded to mean either the accessor (or reference) object or the implicit dereference. > They are also cleaner, much > more efficient and, what is far more important, they are *primitive*. > Accossor is a new type which means *contravariance*. The stuff is not > composable under inheritance. > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de