I think that even with generators, you don't quite get Go style concurrency due to lack of concurrency for non-IO bound tasks. For a real world use case, suppose you are compiling TypeScript. Without web workers or running in a separate process, the compilation will block because it is CPU bound. You can get around this with generators by explicitly putting in pause points through yielding, but that is assuming that one can break up the task and that it doesn't depend on some external blocking library.
Can someone compare the concurrency method using async/await vs. generators? What are the pro/cons of each?<p>It seems that with Async/Await, Generators are not as useful and are more niche. Am I wrong?
I think it is a bad idea to use generators to emulate threads. Because the code becomes difficult to understand and it is easy to make a mistake (for example forget to put a `yield` operator somewhere). I saw examples of such code.<p>If you want threads, then make a syntax or API for them rather than implement hacks nobody will want to deal with later.