Re:Haskell Typeclasses vs. C++ Classes
by munificent on Tuesday October 17, 2017 @12:50PM
(#15492476)
> In fact Javascript and it's prototype system are much more OOP than say C++ classes, or worse, Java classes.
I'm not sure what your ordering relation is here, but if it has something to do with how "purely object-oriented" a language is, then, sure, JavaScript is more OOP than C++ and Java since classes are not first-class in the latter.
But Smalltalk, which is class-based, is even more OOP than JavaScript since in Smalltalk, constructor calls are simply regular method calls (unlike JS which has a special "new" keyword) and there are no primitive objects (unlike JS, which distinguishes between primitive types and their boxed forms, though it tries to obscure that fact).
> COP is especially appropriate because if you don't follow the type rules, you go to compiler jail.
Smalltalk, Ruby, and Python are all class-based OOP languages but do not have static type systems with lots of compiler errors.
I'm not sure what your ordering relation is here, but if it has something to do with how "purely object-oriented" a language is, then, sure, JavaScript is more OOP than C++ and Java since classes are not first-class in the latter.
But Smalltalk, which is class-based, is even more OOP than JavaScript since in Smalltalk, constructor calls are simply regular method calls (unlike JS which has a special "new" keyword) and there are no primitive objects (unlike JS, which distinguishes between primitive types and their boxed forms, though it tries to obscure that fact).
> COP is especially appropriate because if you don't follow the type rules, you go to compiler jail.
Smalltalk, Ruby, and Python are all class-based OOP languages but do not have static type systems with lots of compiler errors.