It’s a funny joke. But there are some very real difficulties with classical inheritance, the main one being “what is a class”? If a class if an object, then it must necessarily have a class of it’s own, so what’s the class of Class? Logically, the class of Class is Class, so you have a circular inheritance loop at the top of your hierarchy.
Alternately you can say that a class is not an object, it is syntax. This creates a whole other set of problems. Where do you put your static methods? How do you manipulate classes? You need a whole introspection API.
JavaScript sidesteps all these issues with prototypical inheritance, which is way simpler.
Classes are used to generate types. In a reflective environment, there may be an API to get information about the class used to generate types, but that API will give you a type that represents the class, not the class itself.
Where do you put your static methods?
Maybe you don't understand the point of classes. It is a way of organizing code within a language. A class is a unit of code organization. Your static methods are put within that class unit to organize it.
218
u/[deleted] May 16 '21
has anyone?