yield and new : SpiderMonkey and the draft Spec

Brendan Eich brendan at mozilla.com
Mon Mar 14 22:08:52 PDT 2011


On Mar 14, 2011, at 11:50 PM, John J. Barton wrote:

> On 11:59 AM, Brendan Eich wrote:
>> However, there's no way for a generator function to return that instance, because a generator function always implicitly returns a fresh generator iterator when invoked. It could store |this| in the heap, and whatever value |this| receives is saved as part of the shallow continuation capture by the generator.
>> 
> The implicit return of a fresh generator iterator makes the example confusing.

It's just like Python.

/be



More information about the es-discuss mailing list