Hacker News new | ask | show | jobs
by babby 4023 days ago
require('bluebird').coroutine function*() {}

Promises + Generators = The sweet spot.

Check out https://www.npmjs.com/package/coroutiner to make it stupid-easy to coroutine your entire app.

1 comments

That is one perfectly fine way to do it. But that is exactly what i want to highlight. The generators. You can combine them with promises, callbacks, even the CSP channels. But you need the generator. That is where magic happens and no amount of library code will do that for you, one needs compiler support (or a macro...)