Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The reason I don't want to write much in node.js is simply I don't like callbacks. It's an inversion of control, and not a necessary one. One can easily invert control back to direct style by using futures/promises. There are even node.js extensions that do various conversions back to direct style, but since the language doesn't endorse any particular one you can't use them across a whole app (unless you write everything yourself).


The stack of callbacks piling up is definitely not a great feature of node.js code. You can mitigate it by using declared functions instead of anonymous functions but that also becomes burdensome when all your callback function does is call something else that also requires a callback.

This will be an interesting problem for node developers to solve. I like the Go approach of using channels. Twisted uses deferreds and inline yields depending on your preference. There are some libraries out there that people have written for node.js that also help.


tame.js solves this to an extent by allowing await and defer calls in your JS code. Not native, of course.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: