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

Reply via email to