3 ms·
> bob taught me about what a weak map should really do: keep a value alive when both the map and the key are alive. It blew my mind. Can you share more details
by bgirard 4y ago
> bob taught me about what a weak map should really do: keep a value alive when both the map and the key are alive. It blew my mind.
Can you share more details? That's so counter intuitive to how I think of WeakMaps and I would like to know more.
- pizlonator 4y agoI called it a “weak map” rather than “WeakMap” deliberately. Bob was describing what he wanted, not what he got. However, if memory serves, the JS weak map has the semantics bob wanted: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...