News for hackers. Stuff that matters.
Re:ToffeeScript – CoffeeScript with async syntax and some ad... by jacobolus on Saturday October 26, 2013 @08:07AM (#6617116)
“Callback hell” is when you need to do many asynchronous actions / call several asynchronous APIs with inputs to each call depending on the delayed results of some other call(s), and you are using callbacks to organize your control flow. Often you end up with either a large set of named functions being passed around as callbacks, or a deeply nested hierarchy of anonymous callbacks. Either way, control flow can be difficult to follow or reason about, both when reading the code and when debugging. Even simple tasks take large amounts of boilerplate code.

The generated code is using callbacks. The point is that instead of writing something like (a cleaner, but still ugly, version of) the generated code on the right, you’d instead write the (quite easy to read) toffeescript code on the left.

That said, I think coffeescript’s “it’s just javascript” slogan (and goal of generating readable code) is one of its most important features. It has to be quite a bit harder to debug than the coffeescript version, since the generated code has control flow that’s so different looking from the input.

Re:ToffeeScript – CoffeeScript with async syntax and some ad... by joeblau on Saturday October 26, 2013 @09:38AM (#6617346)
What did you use to create the generated JavaScript? I'm still new to this and trying to figure out out.
Re:ToffeeScript – CoffeeScript with async syntax and some ad... by michaelmior on Saturday October 26, 2013 @10:30AM (#6617501)
toffeescript is a language which has a compiler that generates Javascript.