Re: ANN: H98 FFI Addendum 1.0, Release Candidate 13

Alastair Reid <[email protected]>
Newsgroups gmane.comp.lang.haskell.ffi
Organization Reid Consulting (UK) Ltd
Message-ID <[email protected]>
I think it's ok for the finalizer function to delete the environment object if 
it wants isn't it?  

This isn't always the right thing to do but I think it is in the common case 
that there is a unique environment object for every finalized object.

In the other common case that there is a single environment object for a set 
of objects (e.g., for all objects of the same 'type'), the finalizer might 
decrement a reference count on the environment object.

Have I missed some subtlety?

--
Alastair Reid


> Regarding
>
> 	type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> IO ())
>
> 	newForeignPtrEnv :: FinalizerEnvPtr env a ->
> 		Ptr env -> Ptr a -> IO (ForeignPtr a)
> 	addForeignPtrFinalizerEnv :: FinalizerEnvPtr env a ->
> 		Ptr env -> ForeignPtr a -> IO ()
>
> Doesn't this mean that the env must be either static storage (gaining
> nothing) or dynamic storage that cannot be reclaimed (which brings us
> back to where we started)?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.