Is multiple inheritance allowed (or to be allowed) in Julia?



I am faced with an application which could use multiple inheritance to avoid repetition and arbitrariness in the type tree structure. As you know, multiple inheritance is nice to have when there 2 or more independent ways to classify the types, each associated with some behaviour. So I wonder if such a thing exists in Julia or if it may be added in the future.


Multiple inheritance is pretty unlikely to make it into Julia, but traits already work, and may eventually be integrated into the language.


Interesting. From a quick scan, I realize traits can be used to define constraints on types while dispatching, that is defining traits that the arguments’ types should respect. I will read more on sub-traits; they could provide an alternative to multiple inheritance. Thanks.


I’d also recommend traits, as @cstjean did. Another thing is to use composition instead of (multiple) inheritance.


I describe how to use traits and small functions to allow for multiple inheritance in here:

I think that programming Julia requires a bit more of a change from standard OO thinking though, and that you should always be thinking about inheriting behavior/actions and not implementation.