@monorail it's good
most object-oriented languages are disappointing (why do they all use classes rather than prototypes) but the concept be good
@00dani i like classes
i don't really understand prototypes at all
in your typical classical oo model, you have objects containing attributes, and those objects have a class which contains the methods you can perform on the object
it starts getting complicated when you think through more advanced features: do static attributes also live on the class? does that make it an object? where do static methods live that differentiates them from instance methods? what if you want to put custom methods on a particular object? where do traits fit into the hierarchy? etc.
ruby is classical and addresses those needs, but it does so by giving every object a hidden additional class called an "eigenclass". static and object-specific methods live in secret eigenclasses. it's weird
you can avoid that complexity by eliminating classes entirely. instead, you just have objects, and they have attributes. you don't need a separate structure to hold methods, because an attribute can trivially just contain a method. each object can be designated one or more prototypes, which simply means that if you can't find an attribute on an object, you check if the prototypes have it. that's it
base classes? prototypes. traits? also prototypes. statics? just live on a "class" object instead of an "instance" object. easy.
for instance: you're guaranteed to be able to pass constructors around as parameters, so you don't need to define factories that more-or-less exist to wrap up constructors in objects? some classical languages do treat classes as objects anyway and also achieve this benefit, but many don't
even without multiple inheritance (which is sadly something js lacks), traits still work out fine since you can treat them as a pile of object-specific methods. obviously it's nicer if you can just use the trait itself as an additional prototype ofc, but the flexibility of prototypal oo means it's still possible without that option
overall there's really no functional disadvantage to using a prototypal model, it's conceptually simpler, and the flexibility is often valuable, so
re: tangent and bleh bit negative re prototype discussion
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!