I'm trying to find out what is the difference between mixing traits via Cake pattern and mixing them via old fashioned extending. Here are my two examples:
Via extending
trait X {
def foo()
}
trait Y extends X {
def bar()
}
class Z extends Y {
def foo() = ()
def bar() = ()
}
And via Cake
trait N {
def foo()
}
trait M {
this: N =>
def bar()
}
class U extends M with N {
def bar() = ()
def foo() = ()
}
What are the benefits of the cake approach? They are both the same for me. Maybe I'm wrong, but I can't see any significant difference.