Re:ES6 generators in depth
by tlrobinson on Monday March 30, 2015 @01:54PM
(#9291252)
FYI, "yield" has been a reserved word since ES5 and "await" is becoming reserved in ES6 (for eventual use in ES7): https://mathiasbynens.be/notes/reserved-keywords
It seems like a word must be reserved for at least one ES version prior to it being used.
I don't agree the keyword "generator" would have been ideal. It wouldn't work when using 'enhanced object literals' [1], where you can declare a method without even using the keyword "function". In this case, if you want the method to be a generator, you can just put an asterisk in front of its name, so it's consistent with the "function*" syntax.
[1] https://babeljs.io/docs/learn-es6/#enhanced-object-literals