Finalizers Ride Again

George Russell ger at
Fri Oct 11 16:17:42 EDT 2002

Malcolm Wallace wrote (about PVar's, my proposed interface for useful mutable 
state in such a way that they can be implemented in NHC, GHC and Hugs):
> I'll need to think some more about the details of PVars, but my first
> reaction is that they would very easy to implement.  However, I fear it
> may be no good persuading me of their value if you cannot also persuade
> the other implementations to adopt them, so I'd like to hear what Hugs
> and ghc people have to say, especially whether they would also solve
> the problems with mutable shared state raised by Alastair.
I don't see that it's necessary for us to come to a decision right now about PVars
unless we want to put them in the FFI standard.  Well we could do that, in the
same way as we have unsafePerformIO, if it's what it takes us to see the back of 
this finalizers discussion, but I don't think it's particularly necessary; although 
I think it might be a good idea to have a standard definition of something like PVars 
so that people can do useful manipulations of mutable state in finalizers, such things 
don't really seem to me to belong in an FFI standard.

What's important now is that I think I've proved the point that there is an interface
to mutable state which can be manipulated usefully and safely from Haskell finalizers in
all of Hugs, GHC and NHC.  Also, in view of Simon Marlow's patch and what Malcolm Wallace 
has said, it looks as if Haskell finalizers are at least implementable by all three.
Therefore I see very little left to stop them going back into the FFI standard.
I'm about to go on holiday for several days, so I look forward to coming back to find
the whole issue safely buried in the FFI archives. 8-)

More information about the FFI mailing list