TJ Holowaychuk's criticisms of NodeJs
node.js
Solution
1: can happen, when you wrap a stream in a function:
function doSomething (callback) {
var stream = createStream();
stream.resume();
stream.on('end', callback);
stream.on('error', callback);
}
so, what if `end` fires, then `error` fires?
2: the same thing, what if nothing fires (remove `stream.resume` for example)? This obviously a bug in the function, but what you see is that everything just hangs.
4: you naively hook some asynchronous functions to emit `error` events from emitter, then when the error occurs, a listener tries to destroy emitter, causes another `error` event and ends up in an infinite loop.
5,6,7: each emitter without `error` listener can potentially crash your app. You have two options: try to understand where it is safe to omit one or add them explicitly everywhere.
8: debatable. TJ is a proponent of coroutines, so it's just his opinion.
Problem
Back story, read: https://medium.com/code-adventures/4ba9e7f3e52b TJ says node fails because: - you may get duplicate callbacks - you may not get a callback at all (lost in limbo) - you may get out-of-band errors - emitters may get multiple “error” events - missing “error” events sends everything to hell - often unsure what requires “error” handlers - “error” handlers are very verbose - callbacks suck Can someone inform on the issues TJ mentions? For example, I've never seen problems with callbacks being double-executed. Under what conditions would it/they occur? EDIT For those voting to close: If you don't know who TJ is, he's responsible for the majority of npm modules. So this isn't "idle" ranting by an uninformed user. His departure will greatly hurt nodejs and this question attempts to get answers as to specifics of the criticisms. I never see these issues. Do you?