3 ms·
> Classes were never definitional for OO, so prototypes, as originated in Self and adopted in JS, are not a violation of it. If we put classes and prototypes i
by slver 5y ago
> Classes were never definitional for OO, so prototypes, as originated in Self and adopted in JS, are not a violation of it.
If we put classes and prototypes in stark opposition, we can say yes, classes are not foundational. But what's the main distinction between classes and prototypes? One is defined statically and other dynamically. Static/dynamic distinction is a matter of optimization, it's not fundamental to the concept.
So I think when someone says "classes" when discussing OOP, they also imply prototypes, templates and all other forms of "molds" for objects that provides for their initial definition when created. In living systems we'd call this DNA. In engineering it's the combination of technical specifications and the equipment we use to materialize them in a factory.
- cout 5y agoI like the use of the word "mold" here; I've not heard it applied to programming before. Manufactured objects are often very different from the prototype, but it's harder to differ substantially from the mold.
- lifthrasiir 5y agoIt's rather commonly used as a metaphor for classes (synonym: templates), I've seen that multiple times. More recently Urbit's Hoon language used the word for type-assertion functions [1], though I'm very sure that its choice is mostly due to its idiosyncratic naming convention where each class of words have the same number of letters. [1] https://urbit.org/docs/hoon/hoon-school/molds/ https://urbit.org/docs/hoon/hoon-school/molds/