Multiple Parent Types: How to go about it?

Multiple inheritance is neither necessary nor desirable. It is a construct which sounds nice in principle but almost always results in poor software design and unnecessary complexity. The Julia community’s preference for composition and Julia’s pseudo-traits is very much in line with the opinions of the broader software engineering and programming language theory communities.

I would much prefer that the Julia developers spend their very valuable time on more important issues, such as compiler latency, or more useful features, such as first-class traits (as opposed to the current “Holy trait trick”).

You’ve missed the point of issue #5. Traits are a kind of multiple inheritance of behavior, which is seperate from inheritance of structure. The comment I linked to includes an overview about traits.

That is, advocating for better traits is advocating for a certain kind of multiple inheritance.

1 Like

This has been addressed in some of the discussions linked above, but maybe it helps to reiterate that

  1. Julia does not have “inheritance” of fields, either single or multiple, and probably never will.

  2. Types have supertypes. Supertypes are always abstract. This is useful for dispatch, mostly, and it should be thought of as a convenience feature that could be implemented with eg traits if we didn’t have it.

  3. Traits are a special case of type stable mappings that allow implementing multiple supertype-like relations, among other things. But they are much more general than that, and mesh well with how Julia works.

1 Like

11 posts were split to a new topic: Deep dive detangling terms: multiple inheritance vs. traits