title: Replacing delegation with cake
body: <p>At the moment I'm stacking features on a class with delegation</p>
  
  <pre><code>trait Backend {
    def product(id: Int): String
  }
  
  class MyBackend extends Backend {
    def product(id: Int) = "My product"
  }
  
  class LoggingBackend(underlying: Backend) extends Backend {
    override def product(id: Int) = {
      println(s"get product $id")
      underlying.product(id)
    }
  }
  
  class CachingBackend(underlying: Backend) extends Backend { /* ... */ }
  </code></pre>
  
  <p>Is it possible to replace this code with something like this?</p>
  
  <pre><code>trait Logging {
    this : Backend =&gt;
  
    def product(id: Int) = {
      println(s"get product $id")
      /* Don't know what to write here */
    }
  }
  
  class MyLoggingBackend extends MyBackend with Logging
  </code></pre>