1) The defaults are all crap. == operator is 99% useless. Sometimes it is nice to compare '1' == 1 or x == null (or undefined). However the thruthification of things and fun things like "\n \t\r" == 0 being true are insane. Variables are global by default, local via var. That is just... oh so wrong.
2) Clusterfuck of overrides. That means that if I have an object, call it O. And O has a property "foo". "foo" can be a method (function), foo can be "defined" as a class-level method. foo can be injected later as a method. foo can be accidentally overridden into an object. There is just so much that can go wrong, that many languages check at compile time.
3) No static typing. You may say "static typing is too restricting" to which I answer, no, it is freedom. You see if you look at ActionScript, AS has a hybrid ECMA script. It is javascript except it has classes. You can define something as a dynamic object, or something as a class. The great thing about classes is you can give a method arguments that expect a certain type. And a compiler will tell you about it. That means tools like IntelliJ can know where the definition is letting contextual navigation happen, compiler can complain about bugs before they even happen, and it can be optimized at compile time. In AS statically typed objects run much faster because much better assumptions can be made by the compiler.
4) Function arguments are a joke. The arguments "array" is what arguments really are. It has vararg but not in a nice mechanism. In fact look at coffeescript:
race = (winner, runners...) -> print winner, runners
race = function() { var runners, winner; winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : []; return print(winner, runners); };
It is basically complex by default.
In the end, these things really mean one thing: Great for rapid prototyping, bad for long-term development. I can see why some developers keep away from JS like the plague. JS's strength is it's object orientation combined with functions as first class citizens. It's weakness is a completely fly-by-the-seat-of-your-pants object creation strategy, hidden overrides, and lack of maintainability.
This is why I am hoping Dart takes off. It has the potential to resolve these core problems.
No comments:
Post a Comment