On Tue, Jun 2, 2015 at 8:45 AM, Benjamin Gruenaum <[email protected]> wrote:
> Thanks Domenic,
>
> Elaborating on your example with more details. Let's say you need to make
> sure at a certain point that an object has not been tinkered with by user
> code (for security reasons). You can't check the prototype or a symbol since
> those can be faked and you can't keep a regular `Set` because that would
> prevent any `Foo` object from ever being garbage collected.

Exactly.  WeakSet's use-cases are all in the same family as WeakMap,
just with a simpler set-up - rather than associating arbitrary data
with the object, you just associate "is in this set" with it.

~TJ
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to