I agree that it's cancerous, and that making the server side more accessible to front-end developers isn't worth all the problems Node introduces long-term. My dream is still a statically-typed version of Erlang.
I agree that it's cancerous, and that making the server side more accessible to front-end developers isn't worth all the problems Node introduces long-term. My dream is still a statically-typed version of Erlang.
Your (our) dream is about to come true: https://github.com/j14159/mlfe
But I do agree: Sometimes I see people try to push Node/Express as a good choice for teaching basic APIs. Its not the worst choice, but its startling how easy it is to forget how insanely confusing async callbacks are for new devs.
So something like Haskell?
I personally have found my go-to tool for web development - Scala. It is a breeze to work with, and I advise anyone looking to develop web apps to give it a try, especially if you're tired of dynamic languages
Huh? How can you get tripped up by hoisting? I'm genuinely curious.
for (var i = 0; i < 100; ++i) {
foo().then(function() { bar(i); });
}
Then when they realize why this doesn't work, try something like: for (var i = 0; i < 100; ++i) {
var j = i; // this is inside the block, so it's scoped to it, right?
foo().then(function() { bar(j); });
}
And then that breaks too, and it's not at all clear why.It's not that other languages don't have similar limitations - Python also doesn't have block-local variables, for example. The problem with JS is that is uses syntax that strongly implies that it does have block scope, but then quietly makes it do something unexpected when you try.
Ironically, the only other language that I know of that has the same exact problem is VB (pre-.NET one) - its "Dim" statement can similarly be used anywhere inside a function, including inside loops and other block constructs, but the scope is always the entire function.
And as I'm sure you know, JS now supports block scoped variables through `let` and `const`.
Reminds me of these post: http://prog21.dadgum.com/203.html