title: How to delegate implementation to a property in Kotlin?
body: <p>Kotlin enables me to implement an interface by delegating to a primary constructor argument like so:</p>
  
  <pre><code>class Foo(xs : ArrayList&lt;Int&gt;) : List&lt;Int&gt; by xs { }
  </code></pre>
  
  <p>But this exhibits the backing implementer to the user. Delegating to an anonymous also seems to be ok:</p>
  
  <pre><code>class Foo() : List&lt;Int&gt; by ArrayList&lt;Int&gt;() { }
  </code></pre>
  
  <p>This hides the implementation details, but we loose access to features not provided by the interface, which in this case is mutability.</p>
  
  <p>I would therefore like to delegate the implementation to a property that is not in the primary constructor. What I would like to have is similar to</p>
  
  <pre><code>class Foo() : List&lt;Int&gt; by xs {
      val xs : List&lt;Int&gt; = ArrayList&lt;Int&gt;()
  }
  </code></pre>
  
  <p>which doesn't compile.</p>
  
  <p>Is it possible to have a property defined explicitly in the class body and still be able to delegate implementation to it?</p>