3 ms·
The weak keys is nice as it gives you a place to put "hidden" properties that can only be accessed when combining an object and the WeakMap. When the object is
by pixelcort 13y ago
The weak keys is nice as it gives you a place to put "hidden" properties that can only be accessed when combining an object and the WeakMap. When the object is GC'd, the hidden properties in the WeakMap can as well.
But you can get close using a naming convention on the objects proper, say double underscore prexix or whatnot.
What can't be easily approximated right now is weak values, for identity maps in particular.