Questioning WeakMap.prototype.clear

Jason Orendorff jason.orendorff at
Tue Jan 22 02:47:20 PST 2013

On Mon, Jan 21, 2013 at 6:04 AM, David Bruant <bruant.d at> wrote:

> [...] WeakMap.prototype.clear questions the property that was true before
> its adoption ("you can only modify a weakmap entry if you have the key")

David, would you please elaborate your argument for this invariant? This
the first I've seen it stated.

An invariant can be a powerful thing. Still, I guess my default position is
that (1) the object-capabilities perspective is only one view among many;
(2) even looking at things with an eye for o-c integrity and security,
clearing a data structure seems like a reasonable thing to allow, treating
a reference to the data structure itself as a sufficient capability. It's
(2) that I would especially like you to address.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list