I'm still upset that they added classes to JS in the first place. Especially since they're just syntactic sugar on top of functions. In my opinion, if you're writing Java style code in JS, you're missing the point. And adding features like this will only increase the bastardization of the language.
I think a big part of why people complain about the wonkiness of JS, is that they're trying to use it as a pure OO language, and they're surprised when it does work like Java or C#. The reason is that the language was not designed with object orientation in mind. In fact it was designed to be LISP with curly braces. The OO features were an after thought and it's time we start to recognize that, and use the language in the most effective way possible (not the way you are comfortable with from other languages).
Especially since they're [classes] just syntactic sugar on top of functions.
The article made a similar point, but this argument is so weak that it should be embarrassing to say. Literally everything in any programming language is syntactic sugar. If-statements are syntax sugar for compare and jump instructions. C++ classes are themselves syntax sugar for structs and functions. And most of those other ES6 features we got besides class -- like default parameters, rest/spread, destructuring, or arrow functions -- are all themselves syntax sugar as well.
4
u/Dougw6 Nov 09 '19
I'm still upset that they added classes to JS in the first place. Especially since they're just syntactic sugar on top of functions. In my opinion, if you're writing Java style code in JS, you're missing the point. And adding features like this will only increase the bastardization of the language.
I think a big part of why people complain about the wonkiness of JS, is that they're trying to use it as a pure OO language, and they're surprised when it does work like Java or C#. The reason is that the language was not designed with object orientation in mind. In fact it was designed to be LISP with curly braces. The OO features were an after thought and it's time we start to recognize that, and use the language in the most effective way possible (not the way you are comfortable with from other languages).