From: Jean-Marc Bourguet <jm@bourguet.org>
Subject: Re: Ada has garbage collection
Date: 24 Aug 2004 20:41:44 +0200
Date: 2004-08-24T20:41:25+02:00 [thread overview]
Message-ID: <412b8bd4$0$23952$626a14ce@news.free.fr> (raw)
In-Reply-To: KpWdna_dGbEvJ7fcRVn-qw@gbronline.com
Wes Groleau <groleau+news@freeshell.org> writes:
> OK, we could argue semantics, but every language with
> parameters/data on the call stack has garbage collection
> for all those objects.
The term has been used in relation with dynamic allocation
for so long that I would not be able to hold for that side
without feeling that I'm cheating.
> And Ada makes it far less necessary than some languages to
> avoid pointers and use locals instead.
The major use of GC is not for the cases where Ada allow to
prevent dynamic allocation where other languages force its
use.
> Of course, some problems/data structures almost demand
> pointers, but with sensible encapsulation and package
> designed, controlled types provide all the GC those things
> need.
>
> How does that differ from C++ destructors?
C++ destructors offer exactly the same functionnality as
controlled types -- with an added convenience of beeing less
heavy (they are available for non tagged types). And there
are people in the C++ community holding exactly the same
view as you: that GC is not needed because of that.
Note that I'm not a strong proponent of GC: I feel it
provides the most convenient implementation of shared
ownership policies, it doesn't allow to skip the choice of a
sensible ownership policy for the problem at hand. Too many
proponents of GC seems to argue that shared ownership policy
is the only one needed. Constrained by the languages I
mainly use (C++ for work, Ada when I've no external
constraints), I tend to use design that don't benefit a lot
from GC (but I see places where there would be a benefit)
and I wonder how my design would change if I became used to
a language with GC.
> Java couldn't afford to be without universal GC, because
> it makes almost everything on the heap, and allows no
> definition of destructors.
A static analysis should allow to use stack allocation for
most variables where programmers in other languages would
have used it. But that's a very weak argument. Not
offering explicit stack allocation (along with a Ada's
finalization/C++ destructor feature) is, IMHO, one of the
mistakes of Java.
--
Jean-Marc
prev parent reply other threads:[~2004-08-24 18:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-24 3:49 Ada has garbage collection Wes Groleau
2004-08-24 8:05 ` Florian Weimer
2004-08-24 18:35 ` Randy Brukardt
2004-08-24 18:41 ` Jean-Marc Bourguet [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox