Finalizers strike back

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Fri Oct 11 11:03:57 EDT 2002


Alastair Reid <alastair at reid-consulting-uk.ltd.uk> writes:

> If there's no shared mutable Haskell state, writing finalizers in
> Haskell buys you little - what does a finalizer do other than cleanup
> shared state?  (Note that it doesn't cleanup unshared state - what
> would be the point?)

To be honest, I had always thought that cleaning up unshared state
/was/ the main point of finalisers.  They are a user-level mechanism
for releasing system resources (memory, files, etc) that are not
otherwise directly under the control of the Haskell memory management
system (GC).

The idea of using them to fiddle with the live state of the program
graph is a relatively new one to me, and frankly I'm not surprised
it's so difficult to get it right in a pure language.

Regards,
    Malcolm



More information about the FFI mailing list