Comparing Erlang and Node.js
groups.google.com
groups.google.com
Maybe rather than taking it as flame-bait & starting a holy war over it, we could take a deep breath and pause to remember that not only does e-Mail always come across as more abrasive than it should, SOME programmers have that 'just sorta mildly autistic sometimes(1)' difficulty expressing themselves in ways that take the time to address all those layers of social nicety that people sometimes expect. (more gruff, factual communication, less time for mediating language).
It seems to me that this is actually a really great opportunity to put a list of things on the node.js TODO list (some of which, I think is already available through various addins).
If Joe Amstrong is one of the creators of Erlang, he's clearly quite brilliant as a programmer and his evaluation of node's should be taken for what it is: a great opportunity to make node better.
(1)Not that I'm accusing the OP of that in any way ... it's just that the "tone" isn't really relevant to the rest of the discussion.
edit actually, on subsequent readings, it sounds less abraisive as well. Even he says that he doesn't know why node was created, but does know why Erlang was.
It kindof reminds me of the quote that was attributed to Einstein:
"Everybody is a genius. But if you judge a fish by its
ability to climb a tree, it will live its whole life
believing that it is stupid."
— Albert EinsteinErlang and Javascript are similar in that they both developed in highly asynchronous environments. And with multiple instances of Node.js, they have similar models of getting things done concurrently; that is, share nothing, pass and handle messages.
Both communities seem to prefer dynamic and/or functional solutions to programming problems rather than the sort of solutions you see in statically typed, "object oriented" languages. Though Node.js does make use of Javascript's object model, whereas Erlang uses very light weight processes to separate concerns.
Erlang's syntax is "weirder" where weird means doesn't look like C. It's semantics and facilities are much more strictly functional, though with some discipline you could use the same semantics in Javascript, minus nice functional features like pattern matching.
He did specifically say "was not designed" for these kind of applications, but that doesn't mean the application layer can't take care of it. In fact I would argue that with Node, you have the possibility of having greater control over your clustering and failover logic.
EDIT: an example to be more specific. The basic libraries such as the code server (in charge of loading the Erlang modules in the VM) are packaged as Erlang applications, which is an OTP framework construct. These parts of the OTP framework themselves are included in the Kernel application, and written in normal Erlang.
Strange, two other comments as I write this and both boil down to how it's not a good comparison. What on Earth makes comparing two programming environments unfair?
(By the way, I might as well save some time and point out that any cited standard should fail to explain why it's also wrong to compare using Node to compare to PHP or any of the other things Node seeks to supplant for some set of use cases.)
I think people are working on things similar to erlang that are built on top of node.
I get the impression that error handling in node is handled the same way as managing control flow - you're directly managing the continuation of every potentially blocking / failing event.
Erlang's "let it crash" / distributed hierarchy of supervisors error-handling style is IMHO one of its most interesting characteristics; I can't see how it could be grafted on node.
What on Earth are you talking about? Erlang is a language/VM combo (it's hard to separate the two), with nothing else between it and the OS. Node sits on top of a VM not really intended for what it is being used for, so Node has another layer between it and the OS. And the programming style engendered by Node.js is the single most bug-ridden programming style I know, for all its other features. Manually-chopped-up asynchronous callback based programming is a terrible paradigm for code reliability.
Erlang is also unparalleled in general for its error handling. I can't even think of another environment that even has a story equivalent to Erlang's cross-cluster supervision trees built in to the core libraries themselves, let alone one with over a decade of refinement.
At least it seems that way to me having looked at erlang for no more than a few hours and using nodejs every day, so take this with a grain of salt :)
Erlang has a scheduler which automatically makes intelligent tuning based on dataflow in ways that are realistically impossible for anybody to do managing callbacks by hand. They aren't "magic", they just take into account a fairly simple cost-per-action model ("reductions") and whether a process is active, has messages to process, or is blocking with an empty mailbox.
A meaningful discussion of node.js capabilities appears to be entirely absent. So either the HN title is flamebait or the author's biases glow in the dark. Choose your adventure.