When using the cake pattern, when would you want to use the self-type annotation eg:
trait DefaultFoo extends Foo {
this: Bar =>
...
}
vs a stub def
trait DefaultFoo extends Foo {
def bar:Bar
...
}
or a stub val
trait DefaultFoo extends Foo {
val bar:Bar
...
}
Update: I'll be a little more specific (hopefully). All three of the forms define the need for a Bar instance. So basically, any non-abstract class mixing in this trait in any one of its forms must provide an implementation of Bar. My question is, when would I want to force an implementation of Bar using the self-type annotation; when would I want to force and implementation of Bar using the def stub and when would I want to force it using the val stub. I hope that now the question is a bit clearer.
Thanks Netta