I'm currently working on porting dojo.Deferreds to node.js. On top of them I am also working on some API sugar that makes it really easy to aggregate the results of multiple deferreds:
(group)
('a', db.query('SELECT A ...'))
('b', db.query('SELECT B ...'))
('c', db.query('SELECT C ...'))
.addCallback(function(results) {
p(results) // {a: ..., b: ..., c: ...}
});
This will make it very easy to run multiple things in parallel, yet handle all of them in one callback.
Deferred[1] is originally used in Python's Twisted framework. It's also used in Bob Ippolito's MochiKit's library. Generally, it's a great abstraction and I am looking forward to see your results. As I recall Twisted has an ability to chain deferrers.
Check http://github.com/felixge/node-deferred for more info.
Do not use wait() too much, it will be memory expensive.