nominolo at googlemail.com
Wed Nov 26 19:07:26 EST 2008
Possible, yes. Advisable, no.
There is no guarantee that the finaliser is ever run, they are
expensive (since they need to be kept separately and checked after
each GC) and there are easier methods. Lava  uses a very
lightweight sharing detection mechanism. Depending on your problem
you might also want to look at Oleg's approach to explicit sharing in
a DSL .
2008/11/26 Andrew Coppin <andrewcoppin at btinternet.com>:
> Here's an interesting question... Is it possible to attach finalisers to a
> value? (That is, have some Haskell code executed when the item in question
> is reclaimed by the GC.) I'm interested in knowing whether a particular data
> structure is shared (i.e., whether it's safe to mutate it or whether it must
> be copied first), and a simple reference-counting scheme looks like the
> easiest option.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
Push the envelope. Watch it bend.
More information about the Haskell-Cafe