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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Should weak counted reference be able to be strengthened? Date: Sat, 22 Nov 2014 09:42:54 +0100 Organization: cbb software GmbH Message-ID: <1tlppwq452jbq$.d1y3trfego8b$.dlg@40tude.net> References: <7d9r3whe43z8$.1f2l3n5cz0zh0$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: wfRpp7ltpEWhI2na6kgpfA.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: news.eternal-september.org comp.lang.ada:23631 Date: 2014-11-22T09:42:54+01:00 List-Id: On Fri, 21 Nov 2014 16:39:25 -0600, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:kywrzxvibzmw$.1h82z2coiciqh$.dlg@40tude.net... >> Why do you need accessors? For Ada's crazy implicit dereference? > > It's not crazy, it's brilliant. ;-) There's really no other way to make > things both easy-to-use and safe. Of course there is a way and without either accessor types or implicit dereference. [...] > The real question is whether there is a real need to have a long-lived > Strong_Reference. I would argue against such a thing, but I don't think it > is clearly an open-and-shut case. Sure, the only purpose of strong references is to be long-lived. >>> The only way to actually reach a referred object is by dereferencing the >>> access discriminant of an Accessor value. The strong reference inside >>> Accessor objects ensure that the referred object will outlive the >>> Accessor object. >> >> It is much simpler to return a plain access type: >> >> function Ptr (Ref : Strong_Reference) return not null access T['Class]; > > Sure, but now you have an extra function with no real purpose. If you use > the accessor form, you don't need any way at all to get the pointer, you > always have access to it. Accessor is a whole type without purpose and all functions it has are without purpose as well. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de