Proposal #1: ForeignPtr
Manuel M. T. Chakravarty
chak at cse.unsw.edu.au
Fri Dec 1 21:21:34 EST 2000
Simon Marlow <simonmar at microsoft.com> wrote,
> I'd like to summarise the current proposals on the table and see if we
> can get a consensus.
>
> Proposal #1: replace ForeignObj with (ForeignPtr a).
>
> * new module ForeignPtr, with the following interface:
>
> module ForeignPtr
> ( ForeignPtr, -- abstract, instance of: Eq
> , newForeignPtr -- :: Ptr a -> IO () -> IO
> (ForeignPtr a)
> , addForeignPtrFinalizer -- :: ForeignPtr a -> IO () -> IO
> ()
> , withForeignPtr -- :: ForeignPtr a -> (Ptr a -> IO
> b) -> IO b
> , foreignPtrToPtr -- :: ForeignPtr a -> Ptr a
> , touchForeignPtr -- :: ForeignPtr a -> IO ()
> , caseForeignPtr -- :: ForeignPtr a ->
> ForeignPtr b
I guess you meant to write `castForeignPtr'?
> )
>
> * deprecate all of ForeignObj
> * replace references to ForeignObj in the FFI spec with
> ForeignPtr.
> * export module ForeignPtr from Foreign.
> * GHC only: deprecate Weak.addForeignFinalizer
I was just about to propose basically the same - so, yes, I
vote for this proposal.
Cheers,
Manuel
More information about the FFI
mailing list