You're missing a function call:

myIterable[Symbol.iterator]().next()  // note parens after the closing
bracket

This follows the spec-internal method GetIterator:
http://tc39.github.io/ecma262/#sec-getiterator

On Tue, Nov 3, 2015 at 5:45 PM, Jane Chen <[email protected]> wrote:

> 4.6.88.  Just tried it in v8 shell.  myIterable[Symbol.iterator].next is
> undefined.
>
> On Tuesday, November 3, 2015 at 3:40:07 PM UTC-8, Ben Noordhuis wrote:
>
>> On Wed, Nov 4, 2015 at 12:17 AM, Jane Chen <[email protected]> wrote:
>> > With the change of behavior in Iterator discussed here:
>> >
>> > https://groups.google.com/forum/#!topic/v8-users/8LkrofVr0aA
>> >
>> > If I have an iterator (natively defined) which supports for ... of
>> loop,
>> > what is the equivalent of calling next to advance it?
>> >
>> > I hope the following js example demonstrates what I mean:
>> >
>> >> myIterable[Symbol.iterator] = function* () {yield 1;}
>> > function* () {yield 1;}
>> >> for (var k of myIterable) print(k);
>> > 1
>> >> myIterable[Symbol.iterator];
>> > function* () {yield 1;}
>> >> myIterable[Symbol.iterator].next();
>> > (shell):1: TypeError: myIterable[Symbol.iterator].next is not a
>> function
>> > myIterable[Symbol.iterator].next();
>> >                             ^
>> > TypeError: myIterable[Symbol.iterator].next is not a function
>> >     at (shell):1:29
>>
>> What version of V8 is that?  It works in 4.6.
>>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to