Tab Atkins Jr. wrote:
Using a primitive string as a key can inadvertently leak the value for a long time, as the key might be interned and long-lived, far past the point when your code has dropped the intended references to it.
Indeed. Strings do not have observable reference semantics at all, so any WeakMap accepting a "foo" key would have to keep the entry alive forever, as "foo" could be uttered by later code. Same for 42 ;-). You might think primitives could be live or dead but only objects are like that.
/be _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

