This page is no longer maintained — Please continue to the home page at

'a class is aways linearized before ...'

No replies
Rob Dickens 3
Joined: 2010-06-17,
User offline. Last seen 42 years 45 weeks ago.

Dear All,

'Programming in Scala' (on p260) explains that,

a class is always linearized before *all* of its superclasses and
mixed in traits.

I never quite understood this at the time, and have just seen it
quoted in Fredrik Skeel Løkke's thesis on design patterns.

After a determined effort to understand, I now reckon it should say,

a class aways appears before its superclasses and mixed-in traits,
in the sequence resulting from its linearization.

From the worked example (Cat class), it looks as though the superclass
is in fact linearised first, followed by each mix-in in turn (from
left to right), and then the class itself is appended last. The
resulting list is then reversed.

Anyone agree?


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland