3 ms·
If they aren't just syntactic sugar - how to you think regenerator works? Show me a generator and I show you perfectly fine, synchronous (though verbose) ES5 co
by jkrems 12y ago
If they aren't just syntactic sugar - how to you think regenerator works? Show me a generator and I show you perfectly fine, synchronous (though verbose) ES5 code doing the exact same thing.
- pdubroy 12y agoWell, "syntactic sugar" usually refers to things that can be translated in a syntactically local, structure-preserving way. I'm aware that generators can be compiled down to an ES5 representation, but it requires non-trivial analysis. Take a look at the example on their home page: https://facebook.github.io/regenerator/ https://facebook.github.io/regenerator/. Do you also consider functions to be syntactic sugar? Because you can also implement them in terms of a switch statement.