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:
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.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.
Thanks,
-antony
--
Antony Courtney
Grad. Student, Dept. of Computer Science, Yale University
[EMAIL PROTECTED] http://www.apocalypse.org/pub/u/antony
_______________________________________________
FFI mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/ffi