Claus Reinke wrote:
I thought it was agreed that the function passed to
Set.prototype.forEach would be called with 3 arguments, the value, the
value again and the context object. This is so that one can use the
same function for Array.prototype.forEach, Map.prototype.forEach and
Set.prototype.forEach.
Yes, I've reopened the bug for this:
https://bugs.ecmascript.org/show_bug.cgi?id=591
Isn't an adapter supporting the use case as simple as:
(v,s) => f(v,v,s) ?
Not if everyone has to write that and wrap it around an
otherwise-reusable f when sharing f among maps, weakmaps and sets.
More generally, is it really a good idea to treat Sets as "Arrays
without duplicate elements"?
That's not the treatment here. The treatment is uniform signature for a
shared forEach callback.
With object model reformation, one could even make set[v] evaluate to
set.has(v).
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss