Rick Waldron (2013-06-24T16:43:03.000Z)
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.
>

It's my pleasure and I'm glad you're finding them useful as a resource
during implementation :)


The problem is that I can't really record my own input... while I'm
talking, no one is taking notes. When I'm done talking, I'm taking notes.
The example Brendan wrote on the board was to illustrate that a "helper"
function could be used to turn arraylikes into iterables before being
passed to Array.from. I said "no" because it contradicts the agreement made
a few lines prior.

While all builtin arraylikes are also iterable now, arraylikes created by
non-built-in (assuming we both use "built-in" to refer to objects defined
by ES) may not implement iterator protocol. Array.from, like
Function.prototype.apply, will allow those objects to be turned into an
array, eg. NodeList, DOMTokenList or jQuery objects. A cowpath that
Array.from was intended to clear and pave was
[].slice.call(arrayLike)/Array.prototype.slice.call(arrayLike). Also, web
devs will be able to use a polyfilled Array.from in code that must run in
browsers that don't/won't support spread (ie. older non-updating browsers).
Hopefully this helps to clarify


Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130624/dfcc222c/attachment.html>
github at esdiscuss.org (2013-07-12T02:27:37.737Z)
It's my pleasure and I'm glad you're finding them useful as a resource
during implementation :)


The problem is that I can't really record my own input... while I'm
talking, no one is taking notes. When I'm done talking, I'm taking notes.
The example Brendan wrote on the board was to illustrate that a "helper"
function could be used to turn arraylikes into iterables before being
passed to Array.from. I said "no" because it contradicts the agreement made
a few lines prior.

While all builtin arraylikes are also iterable now, arraylikes created by
non-built-in (assuming we both use "built-in" to refer to objects defined
by ES) may not implement iterator protocol. `Array.from`, like
`Function.prototype.apply`, will allow those objects to be turned into an
array, eg. `NodeList`, `DOMTokenList` or jQuery objects. A cowpath that
`Array.from` was intended to clear and pave was
`[].slice.call(arrayLike)/Array.prototype.slice.call(arrayLike)`. Also, web
devs will be able to use a polyfilled `Array.from` in code that must run in
browsers that don't/won't support spread (ie. older non-updating browsers).
Hopefully this helps to clarify