yield syntax

Brendan Eich brendan at mozilla.com
Tue May 19 14:36:27 PDT 2009

On May 19, 2009, at 2:00 PM, David-Sarah Hopwood wrote:

> *If* it is allowed, then it should be two. It would be very  
> surprising if
>  foo(a = b, c);
> had two arguments (as it does), but the above expression with yield
> had one.
> But I agree that it may be better not to allow it.

Good; it was a loophole in JS1.7 and up, which I think should be closed.

>> Agreed; this closes the assignment expression loophole.
> This would disallow
>  foo(yield x);
> which seems unnecessary.

I thought so too, but Python keeps its grammar simple this way, and  
simpler is better, ceteris paribus. JS1.7 allows this but also suffers  
the assignment loophole. Getting rid of the latter but not the former  
is grammar-hacking busy work. I haven't done it in the WebKit/ 


More information about the es-discuss mailing list