I think, you are actually wrong about the composeable aspect. Callbacks do not compose by default. Compose means easy chaining of elements without putting glue between each element. The glue would represent error checking. A callback can return an error or a result. So no, you cannot simply compose them, as you would with usual functions.
If you really want to compose callbacks you have to introduce monads, where the context is carried with (like a bind method). And of course there are already abstractions but this shows that raw callbacks are definitely not composable. And what you are saying about the "old" sync way is equally wrong in my opinion. Thinking synchronous is the way you solve problems naturally. Maybe you learned thinking with callbacks, and I admit that it's not that difficult, it's just not beautiful. Coming from a computer science background solving problems beautiful is the most important thing to provide stable and easy to understand code, at least in my opinion. And by the way: Callbacks are stil imperative, just more verbose than (green-)threads or coroutines(yield). Functional programming is a totally different thing. Javascript is not functional, not even a bit ;) Well it has functions, but... Async callbacks are an implementation detail of asynchronous programming, not a pattern everybody should use. Ryan Dahl describes node.js as a simple/low-level layer to create higher abstractions on. He said that higher abstractions are good in general but he see's node as a foundation for that. The best abstractions are green threads. Every problem you have can be solved with a bunch of green threads because you can create millions of them. They can talk to each other using messaging without locks and can be distributed as well without losing the mental model. And the best thing: They compose by default! -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
