Finalizers: conclusion?

Antony Courtney antony at apocalypse.org
Mon Oct 21 14:50:03 EDT 2002


Hi,

I have only been watching this Haskell finalizers discussion from a 
great distance, but I am keenly interested in the outcome, as it will 
require a significant overhaul of some of my own FFI-based library code. 
  (My code currently uses touchForeignPtr in a Haskell finalizer to 
express a liveness dependency, but this is apparently not supported by 
the latest FFI spec. and won't be.)

I would really like to have just a little bit more in-depth 
understanding of why Haskell finalizers are an impossibility.  In 
particular, the current finalizers.txt document on cvs.haskell.org states:

>     We want to be able to use mutable Haskell state from a Haskell
>     finalizer, but we clearly can't use IORefs.  Finalizers which
>     modify IORefs will always contain race conditions.
> 

Although I suspect that the reason why we "clearly can't use IORefs" or 
why such code will "always contain race conditions" is clear and obvious 
to everyone else involved in this discussion, it is not at all clear to 
me as an outsider.  If someone would be kind enough to write just a 
sentence or two clarifying the "obvious" problem, I would be very grateful.

Thanks,

	-antony

-- 
Antony Courtney
Grad. Student, Dept. of Computer Science, Yale University
antony at apocalypse.org          http://www.apocalypse.org/pub/u/antony




More information about the FFI mailing list