comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Should weak counted reference be able to be strengthened?
Date: Sat, 22 Nov 2014 09:42:54 +0100
Date: 2014-11-22T09:42:54+01:00	[thread overview]
Message-ID: <1tlppwq452jbq$.d1y3trfego8b$.dlg@40tude.net> (raw)
In-Reply-To: m4oeuv$a92$1@loke.gir.dk

On Fri, 21 Nov 2014 16:39:25 -0600, Randy Brukardt wrote:

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

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