2 ms·
This guy doesn't know much about javascript, I am guessing. I made some gists that take his code and add minimal changes to it, that fix the problems he complai
by EGreg 15y ago
This guy doesn't know much about javascript, I am guessing. I made some gists that take his code and add minimal changes to it, that fix the problems he complains about:
"Two different code paths, can't do DRY" really?
https://gist.github.com/1678395 https://gist.github.com/1678395
"Oh noo, I can't return the results because they are async". That's what callbacks are for. You know what you CAN do? Do I/O in parallel that's what! Node makes it easy.
https://gist.github.com/1678415 https://gist.github.com/1678415
Anyway I hope this illustrates the point. The guy says it exactly right in one place:
"Once you get your head around thinking in async terms, node.js starts to actually make a lot of sense." And therefore it is not a giant step backwards.
There are more elegant ways to write this (see http://qbix.com/plugins/Q/js/Q.js http://qbix.com/plugins/Q/js/Q.js) but these are just minimal changes to his own code.