Map/Set/WeakMap constructor genericity

Jason Orendorff jason.orendorff at
Fri Nov 2 08:54:25 PDT 2012

In the draft spec, you can basically turn any arbitrary object into a Map.

    var obj = new Date;;, "x", "y");
    assert(, "x") === "y");

The same object can be a Set too. Why not?, ["z"]);
    assert(, "z"), true);

This is intended to make Map/Set/WeakMap subclassable, which is fine.  But
can we specify that without exposing Map initialization as a primitive that
users can apply to arbitrary objects?

As specified, a single object can have [[MapData]] and [[WeakMapData]] and
[[SetData]]. This is a pain to implement, and I don't see the benefit to
web developers.

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

More information about the es-discuss mailing list