State of generators?

Allen Wirfs-Brock allen at
Sat Jun 8 17:35:50 PDT 2013

On Jun 8, 2013, at 1:42 PM, Juan Ignacio Dopazo wrote:

> Hello,
> I'm having trouble understanding the current status of generators. Last time I checked, the standard was what V8 has just implemented:
> - Generator objects had next(), send(), throw() and close() methods
> - These methods returned objects with "value" and "done" properties
> It seems now that:
> - send() and close() are gone

yes, those have been eliminated 

> - next(value) seems to be the same as send(value)

yes, next(value) replaces send(value)

> - All methods seem to return the yielded result, not an object with a "value" property

No, yield produces a nextResult object.  The last line of the yield runtime semantics in is:
         Return the result of GeneratorYield(CreateItrResultObject(value, false)).

Note that a iteration result object is being created and passed to the abstract operation at does the actual context switch. 

> So, is StopIteration back? How do we know if a generator is done?

No.  via a object that implements the ItrResult (name subject to change) interface as specified in

> Thanks,
> Juan
> _______________________________________________
> es-discuss mailing list
> es-discuss at

More information about the es-discuss mailing list