While we're at it, I had an idea to allow to avoid the function*() {}
syntax: why not "yield [noLineTerminator] return" ?
Since "return" is a reserved word which can only appear as first token of an
instruction, enforcing [noLineTerminator] makes sure any recognized use of
'yield return' in ES6 would not be valid in ES5. Also, yield can continue to
be used anywhere else as a variable, if needed.
Code sample :
function counter() {
var i = 0; yield return i++;
}
Another variant would be :
function counter() {
var i = 0; continue return i++;
}
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss