
Brian Hulley wrote: [...]
Ref.write proxiesRef $! (weakProxy : proxies)
(This is nothing to do with your main question, but the strict application looks unnecessary there. Its right hand side is already a constructor cell.) [...]
In other words, if the entry for the proxy in the table stored in the Model dies, can I be absolutely 100% sure that this means the proxy no longer exists in any shape or form in the running program?
My reading of the semantics (http://haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-Weak.html#...) is that you can be sure the proxy *object* is gone. As for referential transparency... Fan-in: If you create equivalent proxies in different calls to createProxy, it's possible that they'll end up referring to the same object (e.g. if the compiler or RTS does something fancy, or you use a memoised smart constructor). So then a single live proxy object *could* protect many elements of your Weak Proxy list from scavenging. Fan-out: It would seem perverse to cry "referential transparency!" and spontaneously clone one of your proxy objects. That *could* lead to deRefWeak returning Nothing while an *equivalent* Proxy object is still alive. Might you run your program on an avant-garde distributed RTS? ;-) Regards, Tom