3 ms·
The problem with passing success/failure as options is they don't compose well. Try to write the twitter example in the blog post this way. Then try to abstract
by ryanto 13y ago
The problem with passing success/failure as options is they don't compose well. Try to write the twitter example in the blog post this way. Then try to abstract each step as a reusable piece. And lastly have a mechanism for handling errors at any step. This looks ugly and is hard to follow. Promises (or generators) provide an API for thinking about async code as composable parts, which leads to easier to understand functions.