Why does Julia not support multiple traits?

I understand the term linearization as defined in the Scala Reference manual. In the case singular inheritance it returns the chain of supertypes starting with the type itself and ending with Any. In the case of multiple inheritance, the order of the list respects all defined subtype relationships.

Scala 2.11 Reference Chapter 5

5.1.2 Class Linearization

The classes reachable through transitive closure of the direct inheritance relation from a class C
are called the base classes of C. Because of mixins, the inheritance relationship on base classes forms in general a directed acyclic graph. A linearization of this graph is defined as follows.
Definition: linearization

Let C be a class with template C1 with … with Cn { stats }. The linearization of C, L( C)
is defined as follows:

L(C) = C, L(Cn) +⃗ … +⃗ L(C1)

Here +⃗ denotes concatenation where elements of the right operand replace identical elements of the left operand:

a, A +⃗ B == a, (A+⃗ B) if a ∉ B  A+⃗ B if a ∈ B

Example

Consider the following class definitions.

abstract class AbsIterator extends AnyRef { ... }
trait RichIterator extends AbsIterator { ... }
class StringIterator extends AbsIterator { ... }
class Iter extends StringIterator with RichIterator { ... }

Then the linearization of class Iter is
{ Iter, RichIterator, StringIterator, AbsIterator, AnyRef, Any }

Note that the linearization of a class refines the inheritance relation: if C
is a subclass of D, then C precedes D in any linearization where both C and D
occur. Linearization also satisfies the property that a linearization of a class
always contains the linearization of its direct superclass as a suffix.

For instance, the linearization of StringIterator is
{ StringIterator, AbsIterator, AnyRef, Any }
which is a suffix of the linearization of its subclass Iter. The same is not true for the linearization of mixins. For instance, the linearization of RichIterator is
{ RichIterator, AbsIterator, AnyRef, Any }
which is not a suffix of the linearization of Iter.

1 Like