4 ms·
I like the idea, it's a bit like how lazy list processing works, but then applied to promises. However, I don't completely see the appeal as soon as ES6 or ES7
by skrebbel 11y ago
I like the idea, it's a bit like how lazy list processing works, but then applied to promises.
However, I don't completely see the appeal as soon as ES6 or ES7 transforms with a tool like Babel are ok for you. ES7 is probably going to have C#-like async/await syntax[0], which takes this problem away entirely and in a much less complicated matter. This syntax works great today with babeljs. And even if you don't dare using experimental ES7 features yet, you can accomplish just about exactly the same with ES6 generators[1].
If you really really need to avoid compiling your code, then I can see the appeal of this "pseudosynchronous" idea, but I do feel that it's much more complex and error prone than setting up a build process instead.
[0] https://github.com/lukehoban/ecmascript-asyncawait https://github.com/lukehoban/ecmascript-asyncawait
[1] http://davidwalsh.name/async-generators http://davidwalsh.name/async-generators