3 ms·
> 2. Multiple inheritance is hard It needn't be. The awkwardness of multiple inheritance in C++ comes from the fact that C++ classes try to be both classes and
by catnaroek 10y ago
> 2. Multiple inheritance is hard
It needn't be. The awkwardness of multiple inheritance in C++ comes from the fact that C++ classes try to be both classes and abstract data types, and end up not fulfilling either role in a satisfactory manner. In OCaml, where abstract data types and classes are completely separate and unrelated mechanisms, multiple inheritance is the most natural thing in the world.
> 4. Hierarchies are awkward for expressing certain relationships
Hierarchies are totally fine. The problem is tying vtables to individual objects. This deprives you of the ability to say “this virtual method operates on two objects of unknown types”, because the only type that can be abstracted is that of the object carrying the vtable. Haskell-style type classes and CLOS-style generic methods don't have this problem.
> 5. Reference semantics may result in unexpected sharing
Unexpected sharing is only a problem with mutable data.
> This has more to do with reference semantics than objects.
How many languages that call themselves “object-oriented” don't equip all objects with a first-class identity?