Finalizers etcetera

Simon Peyton-Jones simonpj at
Thu Oct 10 08:32:23 EDT 2002

| Am I right in thinking that you are proposing that we revert to
| writing Haskell finalizers but that Hugs and NHC programmers would
| have to avoid writing finalizers which manipulate Haskell state while
| GHC would use MVars to protect that state?

Yes, that's right.  It is often the case that there *is* no shared state
so a Haskell finalizer is fine.  But if there is, then there has to be
mechanism for atomic operations.  C is one such mechanism.

But there's something I'm puzzled about.  Hugs does support
non-pre-emptive concurrency, right?  (Where can I find a description of
it.)  So would it not be easy to implement (non-pre-emptive) MVars?  And
if they existed, everything would be fine, right?  We could just use
Haskell finalizers as we all want.  Or am I missing something.

(I'm assuming that the starting point for the entire discussion is
whether finalizers are written in Haskell or C.  Please let me know if I
missed something.)


More information about the FFI mailing list