title: How to refer to a variable in an outer scope
body: <p>If I have the following code:</p>
  
  <pre><code>trait MyTrait {
      val x: Int
  }
  
  def f(_x: Int) = new MyTrait {
      val x = _x
  }
  </code></pre>
  
  <p>If I were to define my function as follows:</p>
  
  <pre><code>def f(x: Int) = new MyTrait {
      val x = x
  }
  </code></pre>
  
  <p>This would be incorrect as val x is just referring to itself. Is there a way I can avoid having to use a different name for 'x' when I want to refer to something in the outer scope?</p>