|
|
|
|
|
by Vekz
554 days ago
|
|
Deeply nested inline anonymous function callbacks are the anti pattern. Decoupled explicit named functions passed as callbacks are a significantly better developer experience and provide clearer stack traces. I never understood why this conversation didn't take the lexicon and instead the imo inferior `async` pattern got pushed hard. |
|
And they don't solve the core issue of async control flow that async/await solves, so it's not an alternative to async/await much less a superior one.
A classic example is when you want to conditionally do something asynchronously like B() in this case.
Versus: Add a couple more layers of this and the async/await function stays simple and flat, and the callback version grows significantly more complex and nested.