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: Mon, 24 Nov 2014 16:15:10 -0600
Date: 2014-11-24T16:15:10-06:00	[thread overview]
Message-ID: <m50alf$mpm$1@loke.gir.dk> (raw)
In-Reply-To: 1tlppwq452jbq$.d1y3trfego8b$.dlg@40tude.net

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



  reply	other threads:[~2014-11-24 22:15 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
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 [this message]
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