"Marcin 'Qrczak' Kowalczyk" <[EMAIL PROTECTED]> writes:

> 05 Oct 2001 17:51:45 +0900, Jens Petersen <[EMAIL PROTECTED]> pisze:
> 
>> IMHO hugs is doing the right thing here.  Shouldn't ghc also
>> close semiclosed handles when all references to them have
>> been dropped?
> 
> I guess it would close, but garbage collection didn't notice yet that
> all references have been dropped.

Perhaps.  Is it meaningful to ask, what is the default average time
between GCs?

> BTW, it's not necessarily semiclosed: you are throwing away the
> contents and it will be open or semiclosed dependent on how much is
> read by readFile before returning (perhaps nothing and it's thus open).

True.

> 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.  In fact in the example I gave one could even
argue that the file need never be opened?

Anyway if hugs can do right, I think the compilers should be able to
too.

Jens

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

Reply via email to