Alastair Reid alastair at
Wed Sep 25 01:18:35 EDT 2002

> Consider regcomp in Test.Regex.Posix. 

I didn't find this example at all convincing because the existing
finalizer was written as a monolithic whole and this is a simpler,
clearer way to write the finalizer.

But, while thinking about what was wrong with the example, I found
something which does convince me.  Suppose you live in a world with
multiple allocators (and, hence, multiple free functions).  [The GHC
folk have this with their mallocFP vs malloc distinction.]  In this
case, you'd have to write a separate finalizer for each allocator
because each allocator has its own free function.  This would be
really inconvenient.

So I think I agree that addFPFinalizer should specify a strict
evaluation order for the finalizers.  I guess what this means for GHC
is that all the finalizers should be executed in a single thread.


More information about the FFI mailing list