7 ms·
> inescapable async-all-the-way down, which necessitates endless lambdas. In other languages it's possible to pick a point at which to invert control back to bl
by 75c84fb8 15y ago
> inescapable async-all-the-way down, which necessitates endless lambdas. In other languages it's possible to pick a point at which to invert control back to blocking-style
I hear you. Have you heard of iced coffee script ?(http://maxtaco.github.com/coffee-script/ http://maxtaco.github.com/coffee-script/) I didn't sleep well the night after I read that.
- mattdw 15y agoLooks much like http://tamejs.org/ http://tamejs.org/ in the semantics. I guess if you're pre-processing anyway, you may as well pre-process all the way.
- mattdw 15y agoOh, same guy. That'd be why.
- no-espam 15y agoI was bummed `await` and `defer` was not merged in. However, after thinking about it, the same result can be had using a good async library. The code is self-documenting if you choose good property names. . follow = (from, to, cb) -> # Invokes four async operations in a series, which requires 4 `await`, `defer` # using iced. Note how error handling is handled # in one place rather than each step. # That's a big drawback for me with await/defer. async.series user: (cb) -> User.find name:from, cb addFollowing: (cb, results) -> results.user.following.push to User.save results.user, cb followee: (cb) -> User.find name:to, cb addFollower: (cb, results) -> results.followee.followers.push from User.update results.followee, cb , (err, results) cb err, results