develooper Front page | perl.perl6.internals | Postings from February 2001

Re: Garbage collection (was Re: JWZ on s/Java/Perl/)

Thread Previous | Thread Next
Damien Neil
February 14, 2001 16:25
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
On Thu, Feb 15, 2001 at 12:11:27AM +0000, Simon Cozens wrote:
> > Using object lifetime to control state is almost never a good idea,
> > even if you have deterministic finalization. 
> A deterministic finalization means we shouldn't need to force programmers
> to have good ideas. Make it easy, remember? :)

Actually, no.  Even if you have a deterministic finalizer, you still
want to separate resource allocation from object lifetime.  What it
means is that, in certain circumstances, you can imply the deallocation
step, which does make things easy.

You don't want GCing the filehandle object to be the only way to close
a filehandle.  (Which is what you often get when you conflate object
finalization and object resource ownership.)  Having it be A way to
close handles is fine, and guaranteeing when finalization occurs is
frequently handy.

                     - Damien
filehandle obj

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About