Re:Google SoundScript: faster OOP for JavaScript
by masklinn on Wednesday February 04, 2015 @04:32PM
(#9000012)
> I can agree that you get a certain degree of flexibility that you don't get with class-based languages
That's not even the case. Not in Javascript anyway. The only thing you get is not having a separate hierarchy of class objects.
Re:Google SoundScript: faster OOP for JavaScript
by kybernetikos on Wednesday February 04, 2015 @06:53PM
(#9000899)
Most class based languages won't let you inherit from an instance, and many won't let you use the same techniques you use to inspect or constrain instances to inspect or constrain classes.
And heck, I'll go further - in my mind, both class-based and prototype-based OOP, at least as present in Javascript or other mainstream languages, sucks because it mixes data with behavior and still suffers from the expression problem, because while you can take any object and modify it for a new interface, a process called monkey patching, that's just a terrible way of doing it.
OOP as a means to achieve polymorphism is simply inadequate for many use-cases. Sometimes it is much better to have type-classes (or similar, like protocols in Clojure). So you know, comparing 2 ways of dealing with OOP, misses the point that OOP on the whole is not enough, even broken as some would say.