I’m going to butcher this. But, in the grand scheme of things a “class” in most languages is just a group of related static functions. When you create an object from a class definition you are creating an object that holds values. When you call a method on that object, you are passing a pointer to the object to a static function.
It’s all just syntactic sugar in any language. Before the class keyword, it was just more explicit in JS.
A class is a function in JS, a class is a separate type in most other languages. I don’t see a meaningful difference.
Would your definition classify most of lisp as a lie? It being implemented with a function shouldn't matter. What about the actual behavior is wrong for a class?
There is no 'class' type. That doesn't make classes fake, any more than a linked list or B-tree is 'fake' in C.
As that link says, objects are not fundamentally class-based because objects don't have to have a class. But you could add classless objects to almost any language without making their classes fake. And when it talks about inheritance, well, you can inherit state in C++ too, it's called 'static'.
Or in shorter form: It's not class-based but it does have classes.
There are no integers in Lambda calculus, only natural numbers Church numerals built out of functions. That doesn't make numeric support a "lie" in Lambda Calculus.
The language has the keyword and the implementation.
It's pretty normal for runtimes to not know about certain language concepts. The C runtime has never heard of switches or while loops, no big deal. If it's in the compiler it's part of the language.
You're missing the forest for the trees. A fixed and reusable prototype, with a constructor, is a class. And when that's part of the language spec, that means the language has classes.
And it doesn't matter what typeof says. I could take a C++ program, replace every instance of the word 'class' with 'struct', and it would work fine. It would still be using classes, even though typeof says 'struct'.
Typeof in javascript calls the constructor a function and it calls objects objects. That's correct and fine. You can't put a class itself into a variable in C++ anyway.
And if you really want to get into the gritty details, it's possible to make a very similar argument that C++ of all languages doesn't have classes. Sure they exist in the source code, but all that pretty syntax gets thrown away and you end up with a naked object or one that just has a pointer to a struct it inherits from. And there's not even a 1:1 relationship between source-code 'classes' and those structs!
> You're missing the forest for the trees. A fixed and reusable prototype, with a constructor, is a class. And when that's part of the language spec, that means the language has classes.
Yes, but prototype is not fixed. Prototype chain is not fixed (you can extend it at any point). All of that is changeable at runtime. You can also change the object's prototype at runtime.
It's all dynamic, and prototype ("class" as you say) doesn't provide any structure/constraints to the object. Thus it's pretty pointless to call it a class. It's just property sharing via a prototype chain. It's nothing like classes in languages like C++, Java, PHP, etc. And it doesn't help anyone understand the language, if you try to see it through that paradigm.