3 ms·
Deferreds make your code nicer, but they still don't magically make your code composable. What would make Node more attractive is if it supported copy-on-write
by peterhunt 15y ago
Deferreds make your code nicer, but they still don't magically make your code composable.
What would make Node more attractive is if it supported copy-on-write multithreading and gave me a way to cheat and use asynchronous I/O (like a wait(myFunctionThatTakesACallbackOrDeferred) function)
- bascule 15y agoThere are many ways to compose deferrables, primarily by grouping several of them together into something which is also a deferrable. See the em-scenario gem for examples: https://github.com/athoune/em-scenario https://github.com/athoune/em-scenario Note: I still think this approach sucks. V8 provides a really awesome shared-nothing multithreading scheme via web workers. It's just nobody uses them.
- peterhunt 15y agoOh right that's definitely true and is much more elegant. I was talking about when a function written in synchronous style (in a long stack of synchronous calls) needs to call something asynchronous.
- ufo 15y agoI wouldn't say the problem with Deferreds is composability - the big problem, as you already mentioned, is fragility towards future changes