Why does Array.from accept non-iterable arraylikes?

Brandon Benvie bbenvie at mozilla.com
Tue Jun 25 11:16:55 PDT 2013

On 6/25/2013 10:33 AM, Allen Wirfs-Brock wrote:
> We could make an exception for iterator, but why? That just introduces 
> an inconsistency in the design. 

I think the motivation was to make it easier to polyfill, but I don't 
think that argument holds for @@iterator. If you're attempting to 
polyfill iteration, then you have to polyfill both ends of it; you have 
to supply both the iterators as well as functions to consume those 
iterators (since you can't polyfill for-of). That means you have control 
over the protocol, and can opt to use something like "__iterator__".

More information about the es-discuss mailing list