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!gandalf.srv.welterde.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: Fri, 21 Nov 2014 16:28:06 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <7d9r3whe43z8$.1f2l3n5cz0zh0$.dlg@40tude.net> <1h5a33dishpky.8m2rngmy7e7x$.dlg@40tude.net> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1416608887 10250 24.196.82.226 (21 Nov 2014 22:28:07 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 21 Nov 2014 22:28:07 +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:23619 Date: 2014-11-21T16:28:06-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1h5a33dishpky.8m2rngmy7e7x$.dlg@40tude.net... > On Fri, 21 Nov 2014 18:24:13 +0000 (UTC), Natasha Kerensikova wrote: > >> On 2014-11-21, Dmitry A. Kazakov wrote: >>> On Fri, 21 Nov 2014 15:00:12 +0000 (UTC), Natasha Kerensikova wrote: >>> >>>> type Accessor (Data : not null access constant T) is limited record >>>> Parent : Strong_Reference; >>>> end record; >>> >>> Why do you need accessors? For Ada's crazy implicit dereference? >> >> Not for implicit dereference, last time I checked my GNAT FSF didn't >> handle it well. >> >> Rather for the reasons explained in >> http://www.adacore.com/adaanswers/gems/gem-107-preventing-deallocation-for-reference-counted-types/ > > Which is misleading. The result should have been an anonymous access. Then > it could not be copied without a conversion. So? You still could convert it to any type and cause it to become dangling. > And there is a safe pattern (in Ada 2005) for handling references without > any access types and without implicit dereference. Sure, but it's practically unusable (as occurred in the containers). >>>> However I agree that the strong reference inside >>>> Accessor is indeed always on the stack, and guaranteed to never escape >>>> from the Accessor object. >>> >>> Helper types is bad design. >> >> I wasn't aware of that. Me either. ;-) Remember that Dmitry often has unique opinions about software design. :-) Randy.