Re: How to correctly spec sequences requiring an iterable

On Fri, Nov 15, 2013 at 11:24 AM, Jason Orendorff <jason.orendorff@gmail.com
> wrote:

> On Fri, Nov 15, 2013 at 10:08 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> > An obvious question that arises is what the definition of iterable is.
> >
> > Is it something for which HasProperty(obj, @@iterator) returns true?
> >
> > Is it something for which GetProperty(obj, @@iterator) returns something
> > other than undefined?
> >
> > Is it something for which GetProperty(obj, @@iterator) returns a callable
> > object?
>
> Array.from[1] has to make this determination, such that it can't "just
> iterate and see". At the moment it is spec'd to use HasProperty(obj,
> @@iterator). But that is inconsistent; other places where we check for
> a method always use the third criterion. I hope Allen can weigh in.
>

I was mid-typing when came through... HasProperty(obj, @@iterator) should
be sufficient since the well known @@iterator symbol can only be that
symbol.

Rick

Received on Friday, 15 November 2013 16:30:03 UTC