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!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Smart pointers and delegation Date: Tue, 1 Aug 2017 18:06:53 -0500 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Tue, 1 Aug 2017 23:06:54 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="14965"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: news.eternal-september.org comp.lang.ada:47551 Date: 2017-08-01T18:06:53-05:00 List-Id: "Dmitry A. Kazakov" 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.