finalizers on handles

Sittampalam, Ganesh ganesh.sittampalam at credit-suisse.com
Tue Jun 23 10:23:44 EDT 2009


Simon Marlow wrote:
> On 20/06/2009 21:46, Ganesh Sittampalam wrote:
>
>> If I'm right, is it really sensible for every handle to have this
>> finalizer? Closing a pipe has externally visible side effects beyond
>> just the release of resources, so it doesn't seem like it should
>> happen non-deterministically.
> 
> Interesting example.  So what should we do?  Don't finalize an FD if
> it might have an externally visible effect?  That seems a bit
> extreme.

I'm not really sure what to do either, otherwise I'd have suggested
something concrete in my first email :-)

One problem is that any move away from having the finalizer on every
handle could easily lead to much more confusion than the current
sitation.

I guess an important question is what the benefits of having the
finalizer are.

Presumably it really is needed in the hGetContents case, since users
should be able to just drop the lazy stream and have everything
associated with it go away.

Since other file operations are done eagerly, isn't it also reasonable
to expect the user to exert explicit control over the handle in those
cases?

Cheers,

Ganesh

=============================================================================== 
 Please access the attached hyperlink for an important electronic communications disclaimer: 
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
 =============================================================================== 
 


More information about the Glasgow-haskell-users mailing list