Cheap ForeignPtr allocation

Alastair Reid alastair at
Tue Sep 3 15:35:15 EDT 2002

> Hi Folks, I'd like to propose two new functions for the ForeignPtr
> interface:

I'm a bit uneasy about this.  

It seems like decisions made on technological grounds (i.e., because
they enable an optimization) tend to date rather quickly because the
technology tends to change too.

The functions may cover a fairly common case of using ForeignPtrs
(though I've never used ForeignObjs or MallocPtrs that way) - but most
code doesn't use ForeignPtrs so it's a common case of an uncommon

It'd be a bit more compelling if the combos made things easier (as the
withFoo functions do) or raised the level of abstraction.

I'm inclined to say: add it to GHC for now and prod us again once a
decent body of examples builds up.

Alastair Reid                 alastair at  
Reid Consulting (UK) Limited

More information about the FFI mailing list