Good stuff. This will come in handy if node.js 0.12 takes much longer.<p>Watching the use of generators in JavaScript and especially node.js is going to be very exciting over the coming years. We're excited at LinkedIn because we write a lot of node.js, and control flow is always being discussed: step, async, stepup, promises, and async generators look to solve a lot of that.<p>Also, checkout the AGen formal spec[1] for asynchronous generators. Raynos and I put it together recently to encourage interoperability between async generator solutions, and we're both using it in personal projects.[2]<p>[1] <a href="https://github.com/AsynchronousGenerators/agen-spec" rel="nofollow">https://github.com/AsynchronousGenerators/agen-spec</a><p>[2] <a href="https://github.com/Raynos/gens" rel="nofollow">https://github.com/Raynos/gens</a>
You should make a browserify transform (<a href="https://github.com/substack/node-browserify" rel="nofollow">https://github.com/substack/node-browserify</a>) so that it can easily be put into a pipeline to convert generator code to es5 code. Folks using browserify will be able to use it very easily.
Thank you! This is so exciting. I've been wanting to try things like go style concurrency (<a href="http://swannodette.github.io/2013/08/24/es6-generators-and-csp/" rel="nofollow">http://swannodette.github.io/2013/08/24/es6-generators-and-c...</a>) in the browser, and this seems like it will help us get there. Granted, haven't tried it yet, and really understand nothing about any of this, but ... Anyway, hooray :)
This is similar to my asyncscript pet project[1] (that was met with much resistance on the Node.js mailing list as it was Yet Another CPS Framework). It drew inspiration from the way that C# creates the state machines for "yield" and "await". The project is dead (it only dealt with async calls and I never got round to "enumeration generators"), but if you are wondering how regenerator works I have a nice explanation at the bottom of readme.md.<p>[1]: <a href="https://github.com/jcdickinson/asyncscript" rel="nofollow">https://github.com/jcdickinson/asyncscript</a>
I couldn't find information why generator functions in JS require '*' in the syntax (ES6 spec/wiki just states this as a fact, but no rationale). Does anybody know?<p>Python manages to work fine without ugly wart in the syntax, and it seems to me that presence of `yield` keyword in body is enough at syntactical level to tell compiler that the function is a generator.