Sometimes, you're in a deeply nested scope, and the alias is useful for the outer object, for instance here.
As explained here, the linearizations of the two types for this
are inverted.
That is, you have this: Y with X
and this: X with Y
.
this
matters (pun intended):
scala> trait X { type T }
defined trait X
scala> trait Y { type T <: String ; def t: T ; def f = t.length }
defined trait Y
scala> trait Y { this: X => type T <: String ; def t: T ; def f = t.length }
<console>:8: error: value length is not a member of Y.this.T
trait Y { this: X => type T <: String ; def t: T ; def f = t.length }
^
scala> trait Y { this: X with Y => type T <: String ; def t: T ; def f = t.length }
defined trait Y
scala> trait Y extends X { type T <: String ; def t: T ; def f = t.length }
defined trait Y
But as the linked, authoritative answer says, it may not matter forever.