3 ms·
It's this thing https://en.wikipedia.org/wiki/Metaobject https://en.wikipedia.org/wiki/Metaobject and how objects work in JavaScript. JS is not class-oriented,
by larodi 2y ago
It's this thing https://en.wikipedia.org/wiki/Metaobject https://en.wikipedia.org/wiki/Metaobject and how objects work in JavaScript. JS is not class-oriented, unlike Java.
This so called inheritance is best understood as linked-lists which "help track the method that acts upon this object". So this' not the OOP in Python (where you have C3 inheritance), nor the one in C++ where you have DFS inheritance, and does not even "support" multiple inheritance (https://en.wikipedia.org/wiki/Multiple_inheritance https://en.wikipedia.org/wiki/Multiple_inheritance). I want to say is not inheritance, but... well it was billed as one, so you can think of it as one. But is in fact a peculiar way of doing method resolution.
- Spivak 2y agoBut object in Python is the metaobject, right? Classes are instances of type, type is an instance of object. Is the difference that one draws a line between classes and instances? So like in JS an object is a "subclass" of its parent in addition to being an instance of it because the line between them doesn't exist. If in JS every object had .prototypes plural it seems like it could work with C3 linearization in exactly the same way.
- larodi 2y agoThere is no such thing as multiple inheritance in JS. You can do mixins, but is not the same thing as it is on object level. There are no classes in JS, but prototypes. So it’s really prototype oriented and very much Lisp-ish in all aspects.