
In particular, the variant of weak reference you suggest is the /ephemeron/ semantics in Hayes. Their reachability rule is:
The value field of an ephemeron is reachable if both (a) the ephemeron (weak pointer object) is reachable, and (b) the key is reachable.
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). The implementation would indeed need to keep some reference to the key and finalizer around after the weak pointer becomes unreachable, perhaps on some weak pointers list, but the same goes for GHC's semantics. The only difference is that the value (which might in turn make a whole bunch of other data reachable) would not have to be retained. 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. luite