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

    var obj = new Date;
    Map.call(obj);
    Map.prototype.set.call(obj, "x", "y");
    assert(Map.prototype.get.call(obj, "x") === "y");

The same object can be a Set too. Why not?

    Set.call(obj, ["z"]);
    assert(Set.prototype.has.call(obj, "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.

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

Reply via email to