System.Mem.Weak semantics question
andrei at lri.fr
Tue Mar 1 12:22:25 CET 2011
The documentation page on System.Mem.Weak  contains the following
sentence: "The finalizer, and the relationship between the key and the
value, exist regardless of whether the program keeps a reference to
the Weak object or not." Our reading of this statement implies, in
- given a key k, a value v, and a weak pointer w <- mkWeak k v Nothing,
- if we lose all references to v and w,
- then the value v will not be garbage-collected as long as we keep a
reference to k, even though we cannot possibly retrieve v from k only.
Is our understanding correct?
Thanks in advance and best regards,
More information about the Libraries