Re:‘This’ in JavaScript
by spinningarrow on Thursday August 03, 2017 @07:46AM
(#14918692)
I may have misunderstood but do you mean that the prototypal class structure is also a mistake? If yes, in which way?
[ Parent
| on HN ]
Re:‘This’ in JavaScript
by mattmanser on Thursday August 03, 2017 @08:21AM
(#14918882)
They ended up having to add classes (albeit as syntactic sugar).
Argue its advantages all you want, but I'd say that's representative of what a failure it's been. One of the last languages supporting prototype-based inheritance has basically given up on it.
Personally, I find it an awkward way to try and encapsulate code, generally, it has terrible performance to boot.
> One of the last languages supporting prototype-based inheritance...
Actually, all this time, both Python and Ruby use what we would call prototype-based inheritance.
https://www.reddit.com/r/node/comments/6oqiyn/is_es6_complet...
https://www.reddit.com/r/learnjavascript/comments/6c6use/how...
Was there ever any issues with prototype-based inheritance? I've always assumed that they added classes simply because of stubborn classical-based programmers who couldn't bother to learn JavaScript correctly.
Re:‘This’ in JavaScript
by spinningarrow on Thursday August 03, 2017 @10:50AM
(#14920046)
That was my impression as well, especially since the class-ish syntactic sugar doesn’t improve performance either.