News for hackers. Stuff that matters.
Re:Classes Are Making Me Sad by coldtea on Wednesday March 08, 2017 @07:51PM (#13825651)
>Which, as above, is easy! But if there's one actual problem with the class keyword it's that it makes people who know Java think they understand JS inheritance.

Which is totally fine, as for all intends and purposes the behavior is the same. You create new instances, and you call methods on them.

The "movable" context (this) will be a little surprising, but for everything else one can write JS for decades with ES6 classes and "OOP", without having to know how the prototypes, objects and functions they de-sugar to work.

Re:Classes Are Making Me Sad by LyndsySimon on Friday March 10, 2017 @10:59AM (#13839544)
> Which is totally fine, as for all intends and purposes the behavior is the same.

Nope :) They're apparently the same, which is not the same as "the same".

> The "movable" context (this) will be a little surprising, but for everything else one can write JS for decades with ES6 classes and "OOP", without having to know how the prototypes, objects and functions they de-sugar to work.

That's just the thing though - there isn't a "movable context", there is only binding. Binding usually happens implicitly, and most of the time things are implicitly bound to what you expect them to be if you're not aware it's happening.

... then comes the moment that you're in an instance's method, and `this` is pointing to an event instead of the object. Oh, boy.

In my experience that moment comes much more often than once every few decades.