Suggestions for Set
brendan at mozilla.com
Wed Oct 3 11:57:29 PDT 2012
Jason Orendorff wrote:
> On Wed, Oct 3, 2012 at 11:34 AM, Brendan Eich<brendan at mozilla.com> wrote:
>>> * the spread syntax just uses the iteration protocol;
>> This differs from Array.from -- any reason not to fall back on the
>> array-like protocol (which for missing 'length' iterates no values)?
> I think ES6 should have a single how-to-iterate behavior shared by
> Array.from, spread syntax, and for-of.
> Whether that includes a fallback to .length or not seems less important to me.
> It seems simpler *not* to include the fallback. Firefox doesn't
> include it at present. Instead, arraylike objects are pretty much all
> iterable. That wasn't hard to do, since our Array.prototype.iterator
> is generic.
I buy it.
Not sure why we didn't do it in the July meeting where we settled on
Array.from testing iterable and falling back on array-like. Perhaps fear
that @iterator customizations will be missing from a number of array-likes.
On that point, does NodeList have an iterator in Firefox now? That's an
obvious Array.from argument type.
More information about the es-discuss