I think linearization of traits should be explained *in terms of* existing examples (locking/logging or even hash cache/basebook) rather than create an abstract hierarchy with Class C having traits T1, T2 etc. (pages 206, 207).
Thus working out the linearization of
class Book(author: String, title: String) extends BaseBook(author, title) with Ordered[Book] with HashScrambling with HashCaching
val myBook = new Book ....
and then showing how a call on myBook.hash propagates up the linearized super classes should be a good way to explain how stackable modifications work (imo).
right now there is no *worked* example and everything is taken "on faith" as it were.
Also, there ought to be a clearer explanation of how linearization works rather than say
" The precise order of the linearization is described in the language specification. It is a little bit complicated ... "
Also,
"Then, whenever you call super inside one of those classes, the invoked method is the next one ***up*** the chain."
"Up" is mildly confusing since the linearization is *represented* as a left to right comma separated list of class/trait names in the language specification.
Again a worked out example (vs class C traits t1, t2 etc) would make clear if "up" means moving left or right on the written down linearization.
Now coming to the actual explanation of linearization in page 207, the language is confusing. e.g: "The last part of the linearization of C is the linearization of class Sup." ---(1)
"last part" would seem to imply that this is (temporally) the last activity.
"This linearization is copied over without any changes."
huh? we just claimed that this was the "last" part. So is the copying a "last + 1"th activity?
"The second to last part is the linearization of the first mixin, trait Trait1, but all classes that are al- ready in the linearization of Sup are left out now,"
But I thought the linearization of Sup was the last actiity as per (1). So how are "all classes that are al- ready in the linearization of Sup" available to "leave out"?
In short, I think this whole section needs a rewrite!