Right, the compromise then is usually to use a descriptor with `enumerable:false` that won't break "the common web" but agreed it's not that reliable or safe ... although developers are interested in the "weak" bit, and most of them most likely won't deal with "new" kind of objects such Proxies and/or frozen/sealed but I understand your point and that's why I've been happily using an Array for keys and one for values that never failed, but also never granted weakness requiring either the usage of clear or delete, which is usually more problematic.
Now I let Mark answer your initial questions and stop talking about polyfills since there's not a clear winner anyway. Regards On Thu, Nov 27, 2014 at 3:17 PM, Andreas Rossberg <[email protected]> wrote: > On 27 November 2014 at 15:58, Andrea Giammarchi > <[email protected]> wrote: > > On Thu, Nov 27, 2014 at 2:44 PM, Andreas Rossberg <[email protected]> > > wrote: > >> Well, there is no functionally correct polyfill for WeakMaps that is > >> actually weak, regardless of .clear. > > > > Please bear with me so I understand your point: if you have `o1` and `o2` > > and `o1.link = o2;`, wouldn't `o2` be "free" once `o1` is not referenced > > anymore ? > > Yes, but this approach only works for regular, extensible, writable > objects o1, i.e., fails for frozen or sealed objects, proxies, etc. > And of course, as a polyfill for weak maps, it breaks other things, > such as correctly iterating over properties of an object used as a > key. > > /Andreas >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

