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 autolearn=unavailable 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!matrix.darkstorm.co.uk!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Should weak counted reference be able to be strengthened? Date: Mon, 24 Nov 2014 16:15:10 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <7d9r3whe43z8$.1f2l3n5cz0zh0$.dlg@40tude.net> <1tlppwq452jbq$.d1y3trfego8b$.dlg@40tude.net> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1416867312 23350 24.196.82.226 (24 Nov 2014 22:15:12 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 24 Nov 2014 22:15:12 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:23703 Date: 2014-11-24T16:15:10-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1tlppwq452jbq$.d1y3trfego8b$.dlg@40tude.net... > On Fri, 21 Nov 2014 16:39:25 -0600, Randy Brukardt wrote: > ... > [...] >> 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. But you (almost?) never need such a thing, at least not without access to underlying object as well. Thus I suggested unifying the Accessor and the Strong_Reference. >>>> 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. I was suggesting that "Accessor" actually be named "Strong_Reference"; I can see no need for a separate Strong_Reference type. As such, there's no extra type here. Instead, you have an extra function "Ptr" which serves no purpose except an extra complication. :-) Randy.