3 ms·
> now we have two incompatible inheritance systems instead. JavaScript still only has prototypal inheritance; class syntax is just sugar[1]. > Meanwhile `this
by jakelazaroff 10y ago
> now we have two incompatible inheritance systems instead.
JavaScript still only has prototypal inheritance; class syntax is just sugar[1].
> Meanwhile `this` still doesn't mean "this"
Even with arrow functions, which don't change the binding of "this"[2]?
> there's still no... boolean types
typeof false === "boolean"
> accessing a nonexistent variable silently fails but happily continues execution
Trying to access a nonexistent variable throws a ReferenceError[3].
> no decent debugger
I disagree, but regardless — doesn't the fault here lie with browsers, not the language itself?
We also get a module system, object and array destructuring, async/await, template strings, generators… it's pretty difficult to say the new ES features are "a step backward".
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
[3] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- kerkeslager 10y ago> JavaScript still only has prototypal inheritance; class syntax is just sugar[1]. Sure, but the patterns you use with the class syntax are incompatible with the patterns you use when using object literals, so libraries pick one or the other, typically the class way. > Even with arrow functions, which don't change the binding of "this"[2]? Even with arrow functions, `function` still exists ands is more frequently used. > Trying to access a nonexistent variable throws a ReferenceError[3]. var a = {}; var b = a.c; Doesn't throw a ReferenceError for me.
- jakelazaroff 10y ago> Sure, but the patterns you use with the class syntax are incompatible with the patterns you use when using object literals How so? You can still access the prototype. It's just that the most common reason to — declaring instance methods — can be accomplished with the easier-to-read class syntax now. > Even with arrow functions, `function` still exists ands is more frequently used. ES6 is a non-breaking change. You can use arrow functions for literally every function you write other than generators. > var a = {}; > var b = a.c; That's a nonexistent property, which probably should throw some sort of error — but that's why we have tools like TypeScript and Flow that can detect this.
- fauigerzigerk 10y ago>You can use arrow functions for literally every function you write other than generators But not for every function I read, and that is the problem with all backward compatible fixes to programming languages. You're just piling on more (sometimes better) features on top of all the old brokenness and everybody has to know all of it.
- ng12 10y agoYeah but that's in no way unique to Javascript. Java developers still have to deal with type erasure due to decisions that were made 20 years ago.
- jakelazaroff 10y agoTrue. I'm not trying to say JavaScript is or was great, just that ES6 is pretty clearly not a step backward (which was the original claim).