Re: Do garbage collected languages need destructors?

From: Dave Harris (brangdon_at_cix.co.uk)
Date: 10/31/03


Date: Fri, 31 Oct 2003 21:28 +0000 (GMT Standard Time)

bob.news@gmx.net (Robert Klemme) wrote (abridged):
> Maybe I'm beeing picky here, but the term "destructor" alone does not
> imply that it is automatically invoked. In C++ this does only happen
> for auto vars.

Right; destructors are merely a key part of the infrastructure.

I expect most of us know how C++ works, so detailed elaboration hardly
seems necessary. If we are being picky, it's maybe worth mentioning that
embedded objects are also destroyed automatically (ie when their
containing object is destroyed). Having automatic destruction in a few key
places makes techniques like reference-counting for heap-allocated objects
much easier.

-- Dave Harris, Nottingham, UK