Generator * syntax

Rick Waldron waldron.rick at
Mon Mar 3 16:03:45 PST 2014

On Mon, Mar 3, 2014 at 6:44 PM, joe <joeedh at> wrote:

> Is the function* syntax for generators final?


> I'm curious what the justification for it is,

The yield keyword was previously only reserved in strict mode (ES5, which means it's perfectly valid JS to have: function f() { var
yield = 1; return yield; } in non-strict mode code. In order to allow
generator functions in both strict and non-strict code, where yield is a
keyword, a new syntactic form was needed, ie. the star (generator)
function. This avoids potentially breaking any existing code that is using
yield as an identifier.

> but mostly I just need to know if it's likely to change.

I'm confident that it will not change.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list