I want weak references to maintain reference-counted pointer to a side table, even after object is destroyed. This would enable to use address of the side table as a stable unique comparison key.
Stable - meaning it does not change when object is destroyed
Unique - it cannot be reused when new object is allocated if there are remaining weak references to the old one.
Currently when copying weak reference that contains non-nil pointer to the side table of the destroyed object, copy contains nil pointer to the side table. This leads to various equality paradoxes - references that used to be distinct became equal; reference and its copy may be non-equal.
That's a custom case of not being able to express existential subtyping as a generic constraint. I hope to include this to the GenericsManifesto by this MR.