> > If it was semiclosed, the physical handle could be closed 
> immediately.
> 
> I think my statement was too weak.  It shouldn't matter whether the
> handle is open or semi-closed: if there are no references left to it
> it should be closed.

And how do you define what it means to have "no references left"?  This
depends on having some well-defined operational semantics for Haskell,
which we don't have.  The upshot is that while GHC might notice that you
have dropped a Handle, another implementation which doesn't do black
holing, stack stubbing, strictness analysis, GC evaluation of selector
thunks or any of the other tricks we do to avoid space leaks might not
notice.  Your program can still run out of file descriptors when
compiled with one compiler but not with another, regardless of the
finalization policy.

Furthermore, as Alastair points out, while GHC will schedule the
finalizer to run, there's no guarantee that it will run in a timely
fashion.  This is something we could hack our way around, I suppose, but
it's ugly.

IMHO if you want to do any kind of heavyweight I/O in Haskell, you
shouldn't use lazy file reading.

Cheers,
        Simon

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to