Hacker News new | ask | show | jobs
by masklinn 971 days ago
> By the time they landed, I was actually pretty disappointed to see the language get classes.

TBF classes are just a layer of syntactic sugar over the (awful) prototypal system (which somewhat sadly few were interested in making better let alone good).

Behind the scenes, they pretty much just create a ctor function and prototype function, except you don't have to mess with the terrible `Object.create` and `.prototype =` nonsense.

Abandoning constructors and going full-on with prototypes would be an other thing entirely, but the reality is that javascript is not very good at it so it's not very fun (except as a proof of concept / investigation of prototype based OO), and pretty much nobody is interested.

1 comments

Yeah, that's fair. I guess I don't really use prototypes anymore either. I find modules and closures are intuitive and powerful, though very different conceptually from classes/prototypes, tools for handling things like private state. Really OOP is what I've grown away from over the years in most languages. I even enjoy writing C++ in this style since its capabilities around things like closures has improved, anonymous namespaces make for a similar "module" scope to what you find in js.