Weak reference semantics - why does a dead weak ref keep its value alive?

Edward Z. Yang ezyang at mit.edu
Mon May 26 22:45:57 UTC 2014


Excerpts from Luite Stegeman's message of 2014-05-23 17:11:30 -0700:
> Actually it's not the same, since I think the finalizer should still be run
> if the weak pointer object is unreachable (and it should run when the key
> becomes unreachable).

I think that's a legitimate point in the design space.

> I haven't been able to think of any issues with considering the value
> unreachable here, so I'm still puzzled as to why GHC's semantics would be
> preferable. It doesn't look like it would complicate implementation too
> much either.

I'm not sure either. Perhaps Simon can comment?

Edward


More information about the ghc-devs mailing list