Array iterator questions

Rick Waldron waldron.rick at
Sat Dec 1 22:03:20 PST 2012

On Sun, Dec 2, 2012 at 12:58 AM, Brendan Eich <brendan at> wrote:

> Jason Orendorff wrote:
>> 1. The current draft spec has Array.prototype.@@iterator() behaving like
>> .values(), so:
>>     for (x of ["a"])
>>         print(x);
>> would print the pair ["0", "a"].
>> The proposal had Array iterators producing values only by default. Why
>> the change?
> This came up two days ago at the TC39 meeting. It's a drafting error.
>  (It seems like it could be a typo, or it could be motivated by a desire
>> for consistency across all collections. If the latter, Map should change,
>> not Array.)
> There is some desire, which motivated Allen's Array.prototype.{keys,values,
> **items} additions in the latest draft, to have self-polymorphic method
> dispatch for implementing {keys,values,items}.
> This led to a discussion that concluded by separating the method naming
> scheme and standard troika (and Andreas Rossberg proposed entries not
> items, which everyone thought better), from the generic object-reflection
> function troika that return iterators for property keys, values, and [key,
> value] pairs. We argued about whether the two name-troikas should match,
> and I think ended up allowing for this.
> Dave had a suggestion for adding a bit of "dict" veneer to the generic
> functions in a standard module, but I'll let him 'splain that.

I was mid-write up for this, but Brendan covered it more succinctly (thank
you). I'll just add that the discussion, including resolution and consensus
will be published on Monday along with all three days of meeting notes. I
plan to file all of the resolutions as tickets on tomorrow, so I suspect that Allen will have
all of the changes in the next revision (barring unforeseen specification
related issues).


>  2. According to, the iterators produced by
>> Array.prototype.keys and .items will expose the index values as strings.
>> Why strings? Don't numbers make more sense?
> Agreed these should not coerce to string.
> /be
>> -j
>> ______________________________**_________________
>> es-discuss mailing list
>> es-discuss at
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list