Dear FFI folks, 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 ) * deprecate all of ForeignObj * replace references to ForeignObj in the FFI spec with ForeignPtr. * export module ForeignPtr from Foreign. * GHC only: deprecate Weak.addForeignFinalizer Cheers, Simon
Simon Marlow <simonmar@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
Simon Marlow <simonmar@microsoft.com> wrote,
I'd like to summarise the current proposals on the table and see if we can get a consensus. [...]
The proposal looks right, but as usual only the "real world" (= my HOpenGL ;-) can prove this. So I vote for this proposal, too, and it should make its way into CVS as soon as possible to make it available for hslibs itself. "It is a capital mistake to theorise in advance of the facts." (http://www.mastertexts.com/Doyle_Arthur_Conan/The_Return_of_Sherlock_Holmes/...) Cheers, Sven
participants (3)
-
Manuel M. T. Chakravarty -
Simon Marlow -
Sven Panne