From: Stephen Leake <Stephe.Leake@nasa.gov>
Subject: Re: containers and garbage collections.
Date: 12 Sep 2003 12:41:48 -0400
Date: 2003-09-12T16:44:16+00:00 [thread overview]
Message-ID: <uy8wuvu0j.fsf@nasa.gov> (raw)
In-Reply-To: 2458809.CYNMQ0Kujp@linux1.krischik.com
Martin Krischik <krischik@users.sourceforge.net> writes:
> Hello,
>
> with this article I want to bring two of my discussions together.
>
> On one side I am avocating garbage collection and one argument against it is
> that proper container library will make garbage collection unneccesary.
I agree; proper containers (and other algorithms) make garbage
collection unnecessary.
> One the other side I am avocating a more complete container librarys
> and one argument against it is that one can allways use access
> types.
Well, one can always use assembly language, too. Containers are an
excellent replacement for access types.
> Without garbage collection access types are pain in the bud.
Hmm. I guess I can agree with that. But garbage collection is a "pain
in the bud" also; you can't use Finalization for good stuff, you can't
predict when the garbage will be collected. I far prefer containers.
> And when the container library only stores "type element is
> private;" than one need to use access types as element.
Yes.
> I have proven that both options are possible
I'm not sure which options you mean by "both options".
> I have implemented a garbage collected storrage pool for GNAT.
That's nice, and I hope you had fun doing it :).
> I also have created containers for "type Element (<>) is abstract
> tagged private;"
Good. I'll have to look at it and compare it to SAL
(http://www.toadmail.com/~ada_wizard/), which provides similar
containers.
> and I belive "type Element is array (Index range <>) of Item;" is
> possible as well (Enabling collection of Strings).
Yes; SAL containers can hold Ada strings, with appropriate storage
management.
Do either of your containers rely on the garbage collected storage
pool?
> Both can't be done with C++ templates - so we should not take the
> all mighty STL as an example.
Hmm. I haven't really looked, but I'd be very surprised if an STL
container can't contain STL Strings.
Of course, there is no such thing as "indefinite abstract tagged
private" in C++. The closest thing is a class with only pure virtual
member functions; that leaves out the "indefinite" part (implied by
the (<>)). So to say "STL" can't do that isn't saying much; you're
really just saying "C++ can't do that".
I'm not clear what you mean by "don't take the STL as an example".
Clearly the STL is limited by the expressiveness of C++; Ada is
better. But the STL has proven to be a very useful library, because of
the functionality it provides; it is reasonable to design an Ada
library that has similar functionality, but takes full advantage of
Ada to do it. I think that is your real goal?
--
-- Stephe
next prev parent reply other threads:[~2003-09-12 16:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-12 15:32 containers and garbage collections Martin Krischik
2003-09-12 16:41 ` Stephen Leake [this message]
2003-09-13 9:37 ` Martin Krischik
2003-09-13 3:33 ` Matthew Heaney
2003-09-13 9:45 ` Martin Krischik
2003-09-13 17:10 ` Matthew Heaney
2003-09-15 13:47 ` Dmitry A. Kazakov
2003-09-15 23:11 ` Matthew Heaney
2003-09-16 17:59 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox