comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: On absurdity of collections 7.6.1 (11.1/3)
Date: Fri, 1 Oct 2021 09:57:35 +0200	[thread overview]
Message-ID: <sj6f1g$tlp$1@gioia.aioe.org> (raw)
In-Reply-To: sj5oph$qss$1@franka.jacob-sparre.dk

On 2021-10-01 03:37, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:sj3r7l$pla$2@gioia.aioe.org...
> ...
>> Yes, every general access type that permits instantiation of
>> Unchecked_Dellocation must indicate the target object's pool, directly,
>> e.g. per fat pointer, or indirectly by some other schema. I see nothing in
>> RM that allows a different implementation. But it is could be a bug by
>> omission and I am not a language lawyer anyway.
> 
> Each access type has only one pool, and all allocations and deallocations
> for that access type use that pool. You can see at RM 13.11(13) that you can
> retrieve the storage pool of T, that wouldn't be possible if it could have
> multiple pools. Allocation for T uses T'Storage_Pool (RM 13.11(16)), and
> deallocation for T also uses T'Storage_Pool (13.11.2(9/3) - I see this
> wording isn't as clear as it could be, but "the storage_pool" here is the
> one for the type T. It is clear, however, from 13.11.2(16/3) that it is
> erroneous to deallocate an object for some other pool than the pool of the
> access type passed to the instance of Unchecked_Deallocation.

At least instantiations of Unchecked_Deallocation should be illegal with 
general access.

> Surely no one would expect the pool to be associated with the object -- it
> would be impossible to interface to C or most other languages that way. Note
> that GNAT insists that all access types are C-compatible.

Normally you cannot allocate C objects intended to be freed from C using 
Ada allocator. This is a common mistake of binding designers which 
promptly crashes the program.

But I see no problem here, especially because the access type must have 
C convention anyway.

> As I've said repeatedly, if you want the behavior of multiple pools with a
> single access type, you have to use the subpool mechanism somehow.

Honestly I still try to find a useful case for subpools. It is nothing 
that could not be easily implemented using existing pools or might help 
fighting off collections etc.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2021-10-01  7:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29  9:09 On absurdity of collections 7.6.1 (11.1/3) Dmitry A. Kazakov
2021-09-29 11:05 ` Simon Wright
2021-09-29 11:20   ` Dmitry A. Kazakov
2021-09-29 21:38     ` Simon Wright
2021-09-30  8:07       ` Dmitry A. Kazakov
2021-09-30  8:35         ` Simon Wright
2021-09-30  8:49           ` Dmitry A. Kazakov
2021-10-01  1:37         ` Randy Brukardt
2021-10-01  7:57           ` Dmitry A. Kazakov [this message]
2021-09-30  0:23     ` Randy Brukardt
2021-09-30  8:06       ` Dmitry A. Kazakov
2021-09-30 18:23 ` G.B.
2021-09-30 18:52   ` Dmitry A. Kazakov
2021-10-01  1:40     ` Randy Brukardt
2021-10-01  7:57       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox