Can't wait till this async issue get solved in CoffeeScript. To me it's currently the biggest weakness in the JS family, especially given how much we all rely on the event-based style of programming in this language.
Exceptions are interesting. The calls are asynchronous so you can't wrap the whole macro in a single try/catch. See node's wiki for an explanation on why this is a problem:
4 comments
[ 4.1 ms ] story [ 26.9 ms ] threadhttps://github.com/joyent/node/wiki/Async-exception-handling
Node encourages people to create functions like:
This way they avoid the whole async + try/catch problem. It should be possible to define a macro that does something similar.Avoiding that trap, individual try/catch statements still work fine: