Originally posted by devius
View Post
What happens when you refer to a variable that hasn't been bound in JavaScript? You get back 'undefined', which, unless you immediately try to use in some other way, will just float to some other part of your program before causing an actual error, leaving you to trace down the actual problem. The sane thing to do would be to immediately say that an unbound variable was accessed, and even better would be to catch these errors as a static check.
But of course, there's a complete lack of static checking unless you use one of the wrapper languages that attempts to rectify that, like TypeScript. There's an entire cottage industry of making languages that compile to JavaScript to try and fix some of its flaws, which probably says something. Meanwhile, in JavaScript, if I accidentally write 'function (x) { x === 9 }', I get no warning that I have written something useless, even though there are multiple easy ways for a language to help me out with such simple mistakes.
It lacks a module system, so people have to create module systems using first-class functions. This wouldn't be so bad, because it's rather like Scheme, except Scheme has macros to make the syntax sane. Meanwhile, at work, we have module imports like:
Code:
module ('myModule', ['foo', 'bar', 'baz', 'quux', 'quuux', 'quuuux'], function (foo, bar, baz, quux, quuuux, quuux) { ... } );
As a target, JavaScript fails for, for instance, functional languages, because it lacks proper tail calls. So, you'd have to implement your own trampolining if you wanted that. JavaScript was going to have it, but then Microsoft torpedoed the language revision that was adding it back in the day.
I'm sure there's more. But I've only been collecting my list for a few weeks. By the way, my last two imports above were in the wrong order accidentally, so I had to waste a couple debug cycles figuring that out.
Originally posted by Pajn
Comment