FFI digest, Vol 1 #218 - 3 msgs

George Russell ger at tzi.de
Mon Sep 30 12:29:37 EDT 2002

Simon Marlow wrote
> Isn't it worth a little effort?  Requiring finalizers to be foreign
> functions is a serious wart in the FFI
I agree, as I've stated before.  It's not just that it's an irritating restriction,
it's also because it looks just the sort of thing that will bite, and bite badly,
when people start implementing non-trivial systems where multiple GCs are operating.
I've already had far too much of this sort of thing.  Tracking down the causes of
unreproducible coredumps caused by mysterious interactions between the scheduler, the 
garbage-collector, and external programs, is not exactly the sort of thing I enjoy
> PS. I'm sorry to keep banging on about this.  Ultimately it doesn't
> really matter to me that much, since I only really use mallocForeignPtr.
> I guess I was just intrigued to see if the problem was really as
> difficult as we'd thought.
I'm glad you are banging on about it.  But since it looks unlikely that there is going
to be agreement on the matter, I suggest the following compromise.  We remove the
restriction that finalizers may not call Haskell functions in the main body of the standard,
but add a note that says that implementations may opt to impose such a restriction,
provided they document it in some standard way.

More information about the FFI mailing list