Core concept

trait DB { def query: String }
trait Service { this: DB => def get = query }
Advertisement

How it works

Confusing at first. Alternative to constructor param.

Advertisement

Trade-offs + gotchas

Cake pattern (DI without framework). Decoupled dependencies.