3 ms·
I'm not sure what's with OP, but according to [1] (and the example on tasks.js) a generator-producing function should have an asterisk before the name. funct
by pfraze 14y ago
I'm not sure what's with OP, but according to [1] (and the example on tasks.js) a generator-producing function should have an asterisk before the name.
function *myCoroutine() { ... }
1. http://www.2ality.com/2012/07/esnext-classes.html http://www.2ality.com/2012/07/esnext-classes.html
- kilovoltaire 14y agoCool, I didn't know about that syntax! Unfortunately it isn't yet supported in Firefox, but I'm glad something like that is in the works.
- pfraze 14y agoHope I didn't offend. I really enjoyed your post; the coroutine syntax seems like an extraordinarily intuitive approach to state machines. Game-changing, maybe. Look forward to trying it.
- a1k0n 14y agoSo, in lieu of the new function* syntax, the presence of the yield keyword in the body is the only thing that distinguishes a generator from a regular function, in the current Firefox implementation?