What should Map iteration do?

Brendan Eich brendan at mozilla.org
Thu Feb 16 14:23:00 PST 2012


Thaddee Tyl wrote:
> Related:
>
> I cannot find the reason why sets and maps were harmoni'ed with
> classes[1].

If you mean specified with classes, I flinched too -- especially at 
private(this), syntax that is dead on arrival for classes (which are 
still not likely to make it into ES6 IMHO).

IIRC Mark used classes to avoid hand-expanding to more verbose 
functions, closures, freeze and seal calls, etc.

>   They do support `mySet["foo"]` for `mySet.has("foo")` and
> `for (something of mySet)` for iteration, do they not?

No to mySet["foo"], yes to iteration (the topic at hand).

>   Classes don't
> have operator overloading, so using classes makes it harder to see the
> usual syntax form.

Not sure about this. You see lack of mySet["foo"] clearly, you just 
don't expect that kind of support to be missing ;-).


> Shouldn't we use proxies instead?

No, because we do not want the overhead of proxies for maps and sets, in 
implementations, or anything observable that might leak to indicate 
proxy-ness.

/be

>
>    [1] http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list