Why does Array.from accept non-iterable arraylikes?

Erik Arvidsson erik.arvidsson at gmail.com
Mon Jun 24 09:07:01 PDT 2013

I'm with Jason here.

The only argument I can vaguely remember is that people want to be
able to use these on old browsers without @@iterator? But I don't see
why a polyfill could not tag things with __iterator__ or something

On Mon, Jun 24, 2013 at 11:54 AM, Jason Orendorff
<jason.orendorff at gmail.com> wrote:
> According to [1], Array.from will first try treating the argument as
> an iterable, then as an arraylike. This is much better than just
> arraylike. The committee considered making it iterable only, but
> decided against it. The rationale recorded in the notes is:
>     RW: No.
> Rick, can you expand on that a bit? :-)
> I propose changing it to iterable only. All builtin arraylike objects
> are iterable now, including arguments, per the same discussion.[1]
> Certainly the idea is for all DOM arraylikes to be iterable. So what
> is this for?
>   [1]: https://github.com/rwldrn/tc39-notes/blob/master/es6/2012-11/nov-29.md#revisit-nov-27-resolution-on-iterables-in-spread
> -j
> P.S. Rick: Thanks again for taking notes at the meetings. They're
> indispensible. I've cloned the repo; grepping the notes has been super
> useful too.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list