title: Initializing interface instance variables
body: <p>I would like to inject (enrich) behavior and state in a Kotlin class by using an interface. Like <code>class Impl : Observable</code>, where Observable contains state. </p>
  
  <p>In Scala using Traits (does work), looking for a Kotlin solution for this one:</p>
  
  <pre class="lang-scala prettyprint-override"><code>object Test extends App {
    val impl = new Impl()
    val observer = new Observer()
    impl.register(observer)
  }
  
  trait Observable {
    // How to do this in Kotlin?
    val observers = List()
  
    def register(observer: Observer) {
      observers.add(observer)
    }
  }
  class Observer
  
  class Parent
  class Impl extends Parent with Observable
  </code></pre>
  
  <p>Attempt in Kotlin (not working):</p>
  
  <pre><code>fun main(args: Array&lt;String&gt;) {
      val impl = Impl()
      val observer = Observer()
      impl.register(observer)
  }
  
  interface Observable {
      // Error: Kotlin: Property initializers are not allowed in interfaces
      val observers = mutableListOf&lt;Observer&gt;()
  
      fun register(observer: Observer) {
          observers.add(observer)
      }
  }
  class Observer
  
  open class Parent
  class Impl : Parent(), Observable
  </code></pre>
  
  <p>It results in this error at the interface instance variable line: <code>Kotlin: Property initializers are not allowed in interfaces</code>.
  How can I initialize instance variables in Kotlin interfaces?
  (Note that in this design, parent classes shouldn't be altered/updated.)</p>
  
  <p><strong>UPDATE: I had an example solution in Java, but that wasn't behaving correctly. "Instance variables" in Java interfaces are automatically static. So I have removed that example.</strong></p>