title: Can I define “method-private” fields in Scala?
body: <p>Given this situation:</p>
  
  <pre><code>object ResourceManager {
  
    private var inited = false
  
    def init(config: Config) {
      if (inited)
        throw new IllegalStateException
      // do initialization
      inited = true
    }
  
  }
  </code></pre>
  
  <p>Is there any way that I could make <code>inited</code> somehow “private to init()”, such that I can be sure that no other method in this class will ever be able to set <code>inited = false</code>?</p>