3 ms·
I agree with your sentiment, but your facts are kind of wrong. Javascript has pretty much nothing to do with Java. It's not a copy of Java in any way. The sema
by acjohnson55 12y ago
I agree with your sentiment, but your facts are kind of wrong.
Javascript has pretty much nothing to do with Java. It's not a copy of Java in any way. The semantics of it are vastly different and much more influenced by Smalltalk, Self, and Lisp. It's an extremely functional language, which is one of the things that has ultimately saved it. Without higher-order functions, you don't have jQuery, Underscore/Lodash, AMD, Backbone, and all the other innovations that made using JS not suck nearly as much.
Don't get me wrong, it's a pretty flawed language. But "something better" is practically here now, in the form of ES6 and TypeScript, and to a lesser extent, Google's "use strong" proposal, which basically deprecates a whole bunch of old cruft. We're about a year away from being unshackled from the worst aspects of JS. You can pick TypeScript or Babel today and have many of the best benefits of future JS.
- UnoriginalGuy 12y ago> Javascript has pretty much nothing to do with Java. It's not a copy of Java in any way. I never said it was. I said: > JavaScript was made in like a weekend and copied Java badly The original author knocked out JavaScript's overall design in a weekend, then they tried to shoehorn in Java-like features badly. That's why we have artifacts like the Date() having month at 0 (like Java). They took a whole bunch of Java concepts and tried to clone them into JS after the naming. My post would have made more sense if you understood a little more about JavaScript's history (both before and after naming). There was definitely a sense of making it more Java-y after it was named that. > It's an extremely functional language No, it just isn't. JavaScript has state all over the darn place. I mean heck it has a global scope with no namespaces at all, that alone is a death nail on calling anything a "functional language." I have no way of writing a function in JavaScript which makes a guarantee that it has no internal state, so the optimiser cannot make assumptions about that function either (e.g. inlining it). In fact I can dynamically change a function's definition at runtime, so it never runs the same code twice.
- acjohnson55 12y agoIf it's just Date semantics, that's a fairly insignificant amount of copying. I'm not saying there isn't superficial similarity. But just look at the fact that Javascript until ES6 has lacked a useful `class` keyword, without which you can't even write a Java program. I suppose "functional" is in the eye of the beholder. I see it in terms of what a language allows you to do, not what it prohibits you from doing. You can absolutely choose not to use shared mutable state.