Proposal: Generator returning a value should throw SyntaxError
brendan at mozilla.com
Thu Sep 26 18:57:58 PDT 2013
We deliberated long and hard, after going through a design state without
return expr;, on this. We agree with
Adam Ahmed wrote:
> Hi all,
> Long-time lurker, first-time poster. Profuse apologies if this was
> mentioned before and I failed to find it.
> I've been using V8's generator implementation in Node 0.11.x recently,
> and have come across what I believe is a footgun with generators
> currently. That is - the ability to return a value, not just yield a
> value. I am proposing that while `return;` is still allowed, `return
> value;` becomes a syntax error within generators.
More information about the es-discuss