Brendan Eich (2013-12-10T18:18:06.000Z)
Brendan Eich wrote:
> Brendan Eich wrote:
>> How about something like this?
>>
>> spawn(function *() {
>>     var gen = this.thread;
>>
>>     stream.on('data', function (data) {
>>           gen.send(data);
>>     });
>>
>>     console.log(yield gen.next());
>> });
>
> Sorry, a generator instance can't next itself, so that last statement 
> should be:
>
>     console.log(yield undefined); 

And in ES6 as amended, this should just be:

     console.log(yield);

Yield (after return, but return is a statement form, of course -- yield 
is an expression form due to send) can have an operand on its right, or 
no operand (meaning yield undefined). Cc'ing Allen to double-check that 
the spec will say so.

/be
domenic at domenicdenicola.com (2013-12-18T03:39:42.071Z)
Brendan Eich wrote:
>     console.log(yield undefined); 

And in ES6 as amended, this should just be:

     console.log(yield);

Yield (after return, but return is a statement form, of course -- yield 
is an expression form due to send) can have an operand on its right, or 
no operand (meaning yield undefined). Cc'ing Allen to double-check that 
the spec will say so.