In article <[EMAIL PROTECTED]>,
 Fergus Henderson <[EMAIL PROTECTED]> wrote:

> > Should there perhaps be something like ...
> > 
> > newForeignPtrWithUserData :: Ptr a -> Ptr b -> FunPtr (Ptr a -> Ptr b -> IO 
> > ()) -> IO (ForeignPtr a)
> > 
> > ... where the second argument is a "userData" pointer that gets passed on 
> > to the finalizer?
> 
> IMHO yes!

Well now what if you want to pass two extra pointers? It's true you 
could "glue" them together, but equally, you can glue together the two 
pointers passed to newForeignPtrWithUserData.

Bear in mind that your newForeignPtrWithUserData, "Ptr a" and "Ptr b" 
are effectively interchangeable. You have one object, a ForeignPtr, that 
holds two pointers. When the ForeignPtr gets finalised, it passes both 
pointers to its finaliser function (assuming it has exactly one). There 
really isn't a lot of difference between the two of them when there's 
only one finaliser.

-- 
Ashley Yakeley, Seattle WA

_______________________________________________
FFI mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/ffi

Reply via email to