Proposal #1: ForeignPtr

Simon Marlow simonmar at microsoft.com
Fri Dec 1 06:41:07 EST 2000


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




More information about the FFI mailing list