Hacker News new | ask | show | jobs
by bluesnowmonkey 5381 days ago
That "callback spaghetti" is called continuation-passing style.

"Programs can be automatically transformed from direct style to CPS." [1]

Do the math.

[1] http://en.wikipedia.org/wiki/Continuation-passing_style

2 comments

I don't fully understand why this makes callback hell better just because it is known under a nicer name. CPS has it's use cases, but application code is not one of them.
Specifically, CPS was intended as a mechanical program transformation to remove the stack, not a style for programmers to actually write their programs in.
And in a lot of other languages writing in CPS incurs a performance penalty (lucky for me it seems to be < 1 order of magnitude in clojure); I assume this is the case in node.js too?