From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.0 tests=BAYES_00,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Custom Storage Pool questions Date: Sun, 19 Sep 2021 13:36:11 +0300 Organization: Tidorum Ltd Message-ID: References: <1d2551f4-8189-44ec-a54d-4a56a672bedcn@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 7bQt2bl3Q6oHV4PIedBBjQ6sqC9727bMCPNRS1nYGXEgj//fsY Cancel-Lock: sha1:XdvmrXWERbOt5jbhVjmSTcJZMP0= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:62778 List-Id: On 2021-09-18 19:19, Dmitry A. Kazakov wrote: > On 2021-09-18 17:59, Niklas Holsti wrote: > >> So you want a way to specify that for a given access type, although >> the accessed object type has a Finalize operation or needs >> finalization, the objects left over in the (at least conceptually) >> associated collection should _not_ be finalized when the scope of the >> access type is left? > > Exactly, especially because these objects are not deallocated, as you > say they are left over. If they wanted GC they should do that. If they > do not, then they should keep their hands off the objects maintained by > the programmer. > >> To me it seems a risky think to do, subverting the normal semantics of >> initialization and finalization. > > Quite the opposite, it is the collection rule that subverts semantics > because objects are not freed, yet mangled. Local variables declared in a subprogram are also not explicitly freed (deallocated), yet they are automatically finalized when the subprogram returns. My understanding of Ada semantic principles is that any object that is initialized should also be finalized. Since the objects left in a collection associated with a local access type become inaccessible when the scope of the access type is left, finalizing them automatically, even without an explicit free, makes sense to me. If you disagree, suggest a change to the ARG and see if you can find supporters. Has this feature of Ada caused you real problems in real applications, or is it only a point of principle for you?