comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Should weak counted reference be able to be strengthened?
Date: Fri, 21 Nov 2014 16:28:06 -0600
Date: 2014-11-21T16:28:06-06:00	[thread overview]
Message-ID: <m4oe9n$a0a$1@loke.gir.dk> (raw)
In-Reply-To: 1h5a33dishpky.8m2rngmy7e7x$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> 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 <mailbox@dmitry-kazakov.de> 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.


  reply	other threads:[~2014-11-21 22:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 11:07 Should weak counted reference be able to be strengthened? Natasha Kerensikova
2014-11-21 13:16 ` Dmitry A. Kazakov
2014-11-21 15:00   ` Natasha Kerensikova
2014-11-21 16:50     ` Dmitry A. Kazakov
2014-11-21 18:24       ` Natasha Kerensikova
2014-11-21 19:36         ` Dmitry A. Kazakov
2014-11-21 22:28           ` Randy Brukardt [this message]
2014-11-22  9:57           ` Natasha Kerensikova
2014-11-22 10:19             ` Dmitry A. Kazakov
2014-11-22 10:36               ` Natasha Kerensikova
2014-11-22 11:15                 ` Dmitry A. Kazakov
2014-11-21 22:39       ` Randy Brukardt
2014-11-21 22:49         ` Shark8
2014-11-22  8:42           ` Dmitry A. Kazakov
2014-11-22  8:42         ` Dmitry A. Kazakov
2014-11-24 22:15           ` Randy Brukardt
2014-11-25  8:36             ` Dmitry A. Kazakov
2014-11-25 21:49               ` Randy Brukardt
2014-11-26  9:28                 ` Dmitry A. Kazakov
2014-11-26 17:51                   ` brbarkstrom
2014-11-26 21:09                   ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox