Finalizers etcetera
Simon Peyton-Jones
simonpj at microsoft.com
Wed Oct 9 11:21:22 EDT 2002
Alastair,
You didn't respond to my proposal, perhaps because it didn't seem like
one
(I've changed a few words)
| a) Haskell finalisers should be available on all systems
|
| b) Finalisers can run at any GC point. The programmer needs to be
aware
| of this. Often it does not matter (e.g. calling 'free' to un-malloc
| some space) but sometimes it does.
|
| c) On systems (like Hugs and NHC) that have no way to builds
uninterruptible
| sequences, you have to roll your own by calling C procedures.
This is easy to specify and easy to implement. It frees stuff promptly
(just after GC). The down-side is that if you are careless you can
write stuff that mutates an IORef that is simultaneously mutated by a
finaliser. In GHC you solve this with MVars. In Hugs you solve this by
writing it in C. But either way, full Haskell is available for
finalisers, and we have the nice simple interface that we all want.
I feel I must be missing something.
Simon
More information about the FFI
mailing list