Comment by spion
11 years ago
Nobody pretended that async didn't exist, we just knew its the best "solution" that ignored the problem.
Which was: throwing away the entire language's compositional features, including the concept of input arguments and return values, results with... poor compositionality, of course.
I thought the problem was callback hell. I've sat through a bunch of promise talks and the problem was never 'JS should be more compositional'.
Yes, uncompositionality of callbacks leads to callback hell. Or to reinventing every single thing but for callbacks. Like array.map (which works with promises) or array.forEach (also works with promises) or every single synchronous function (they all work when passed to promises).
If you solve callback hell for a series of sequential functions by using an actual series of sequential functions, you don't have nested callbacks and you didn't require Promises or composition - just a basic understanding of data structures and first class functions.
It seems you're defining callback hell as 'whatever promises solves' rather than it's common definition of over-nesting.
2 replies →