comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Smart pointers and delegation
Date: Tue, 1 Aug 2017 18:06:53 -0500
Date: 2017-08-01T18:06:53-05:00	[thread overview]
Message-ID: <olr1ie$ejl$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: olplb6$jq0$1@gioia.aioe.org

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:olplb6$jq0$1@gioia.aioe.org...
>I would like to discuss delegation proposal as a replacement for crude, 
>inside out Implicit_Dereference aspect.

There never are "replacements", as existing Ada code has to work.

And as usual, you didn't explain the problem that you're trying to solve.

Implicit_Dereference was designed so a programmer can get control just 
before and just after the use of a dereference. Indeed, it was a replacement 
for an earlier idea where that was part of a storage pool. The problem with 
the storage pool proposal was determining exactly where a dereference ends. 
The description ended up similar to finalization, so someone suggested tying 
the dereference to a controlled object, and Implicit_Dereference was born.

Implicit_Dereference very much matches the Ada model of "hooks" into 
language-defined operations (much like Adjust and Finalize allow 
user-defined operations to be associated with an assignment, rather than 
replacing it).

The main intended use of this feature was to manage the lifetime of accessed 
entities, such as a persistent store, without requiring copies of the 
contained data (which might be large).

Your proposal doesn't meet this particular need, because there is no way to 
tell when the program is finished with a function result. Thus, you either 
have to copy all of the function results (which is what Ada does), which is 
already determined to be too expensive, or you have to return an unsafe 
access to the object (unsafe because you have no way to find out when the 
access is no longer needed by the program).

It seems to me that you are trying to solve some other problem, rather than 
the low-level one that Implicit_Dereference is trying to solve. Perhaps it 
would be a good idea to articulate the problem before outlining the 
solution??

                                                  Randy.
 



  parent reply	other threads:[~2017-08-01 23:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 10:32 Smart pointers and delegation Dmitry A. Kazakov
2017-08-01 15:06 ` Dmitry A. Kazakov
2017-08-01 23:06 ` Randy Brukardt [this message]
2017-08-02  6:20   ` Dmitry A. Kazakov
2017-08-03  3:36     ` Randy Brukardt
2017-08-03  7:40       ` Dmitry A. Kazakov
2017-08-04 23:03         ` Randy Brukardt
2017-08-05  8:33           ` Dmitry A. Kazakov
2017-08-07 22:39             ` Randy Brukardt
2017-08-08  6:27               ` Dmitry A. Kazakov
2017-08-09  0:27                 ` Randy Brukardt
2017-08-09  7:37                   ` Dmitry A. Kazakov
2017-08-09 22:57                     ` Randy Brukardt
2017-08-10  7:56                       ` Dmitry A. Kazakov
2017-08-11  0:17                         ` Randy Brukardt
2017-08-11  6:43                           ` Dmitry A. Kazakov
2017-08-11 20:37                             ` 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