From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Question: What's the difference between pools of pools and Ada 2012's new subpools?
Date: Wed, 13 Feb 2013 18:56:42 -0600
Date: 2013-02-13T18:56:42-06:00 [thread overview]
Message-ID: <kfhcoc$4hm$1@munin.nbi.dk> (raw)
In-Reply-To: 8fe47d10-1889-43e7-be85-510ece95c1a6@googlegroups.com
"Shark8" <onewingedshark@gmail.com> wrote in message
news:8fe47d10-1889-43e7-be85-510ece95c1a6@googlegroups.com...
>I recently asked this question on Stackoverflow (
>http://stackoverflow.com/questions/14840702/what-are-the-differerences-between-the-new-ada-sub-pool-features-and-pools-of-po )
>.
>
> I haven't used pools at all, yet; so it's quite likely I'm missing
> something.
>
> -------
> -- Pool of Pools
> ----------------------------------
> -- Minnesota: Land of 10,000 Lakes
> type Minnesota(Size: Storage_Count) is new Root_Storage_Pool with private;
> type Lake(Size: Storage_Count) is new Root_Storage_Pool with private
> with Storage_Pool => Minnasota;
Aspect Storage_Pool only applies to access types (13.11(15) and others), and
type Lake is not an access type, so this is illegal (and makes no sense as
well).
You could implement one pool by putting other pools within its
implementation (say Minnesota here including a an array of 10000 Lakes :-).
But you'd then have to have a way to select which item belongs to each,
ahem, subpool. And you'd be reinventing the wheel.
There is also the issue of finalization. The subpool mechanism ensures that
objects don't outlive their subpool (pointers to the objects might outlive
the subpool, but not the object themselves), even when the subpool is
explicitly destroyed early (just as Unchecked_Deallocation does). There's no
good way to do that without language support (every hand-written subpool
implementation that we talked about insisted that no controlled, protected,
or task objects be allocated from it, which is obviously limiting).
Let me assure you, getting this right was hard and contentious. It was
nearly dropped a couple of times. Doing it yourself wouldn't be contentious
(I hope!), but it would still be hard. Since the ARG has already done the
dirty work, it's best to use it.
Randy.
Randy.
Randy.
next prev parent reply other threads:[~2013-02-14 0:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-14 0:12 Question: What's the difference between pools of pools and Ada 2012's new subpools? Shark8
2013-02-14 0:56 ` Randy Brukardt [this message]
2013-02-14 2:34 ` Shark8
2013-02-17 1:06 ` Shark8
2013-02-17 9:06 ` Dmitry A. Kazakov
2013-02-17 11:47 ` Simon Wright
2013-02-18 23:24 ` 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