I play with a pie template and I don’t understand something there.
Given the following common code:
trait AServiceComponent {
this: ARepositoryComponent =>
}
trait ARepositoryComponent {}
the next way to mix them works
trait Controller {
this: AServiceComponent =>
}
object Controller extends
Controller with
AServiceComponent with
ARepositoryComponent
But the following:
trait Controller extends AServiceComponent {}
object Controller extends
Controller with
ARepositoryComponent
with an error:
illegal inheritance; self-type Controller does not conform to AServiceComponent selftype AServiceComponent with ARepositoryComponent
Can't we "click" dependencies in a hierarchy if we know that they will be distributed to all subclasses?
Should the compiler be allowed to Controllerhave dependencies if it was not created without their permission?
source
share