Suggestions for Set
brendan at mozilla.com
Tue Oct 2 20:38:54 PDT 2012
Allen Wirfs-Brock wrote:
> Did we talk about the implications of of using iterable protocol if the array
> has holes?
We did, and some of us agreed that a.forEach skips holes, so for (v of
a) should too.
But you are right, that means spread can't sensibly use iteration.
On the other hand, drafted and prototyped iteration on arrays does not
currently skip holes. It fills them in argument list and enclosing array
literals. In the latter it could preserve holes rather than filling them
undefined values, but in argument lists there's no such thing as a hole.
Which is more important, iterating over holes (preserved if possible),
or skipping them and therefore spreading array-likes but not iterables?
More information about the es-discuss