Ross Paterson ross at
Thu Sep 26 07:13:18 EDT 2002

On Thu, Sep 26, 2002 at 09:56:20AM +0100, Simon Marlow wrote:
> Yes, you're right.  We could do it that way.  I'm also concerned about
> adding the extra overhead though, especially if this is something that
> will rarely be needed.  Are we sure this is what we want?

It would
- make addForeignPtrFinalizer usable
- reduce the need to write finalizers in the foreign language
- support the style where you do something and add the finalizer to undo
  it in the same place.
but it's not absolutely essential, if
(1) it's guaranteed that any additional finalizers run before storage
    from mallocForeignPtr is freed, and
(2) there's a C interface hs_free() to free.
Then you could always collect the finalizers in a single foreign language
finalizer that calls them in the right order.

More information about the FFI mailing list