Removal of WeakMap/WeakSet clear
Jason Orendorff
jason.orendorff at gmail.com
Sat Nov 29 09:13:13 PST 2014
On Thu, Nov 27, 2014 at 8:58 AM, Andrea Giammarchi
<andrea.giammarchi at gmail.com> wrote:
> On Thu, Nov 27, 2014 at 2:44 PM, Andreas Rossberg <rossberg at google.com>
> 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 consider the other way around: o1 is still referenced, but
the WeakMap is not.
Under a polyfill, o2 would still be kept alive, even though per spec
there's not supposed to be any way to access it.
-j
More information about the es-discuss
mailing list