title: Is it possible for an optional argument value to depend on another argument in Scala
body: <p>Does anyone know if something like this is possible in Scala:</p>
  
  <pre><code>case class Thing(property:String)
  
  def f(thing:Thing, prop:String = thing.property) = println(prop)
  </code></pre>
  
  <p>The above code doesn't compile; giving the error <code>error: not found: value thing</code> at <code>thing.property</code></p>
  
  <p>The following shows the expected behaviour:</p>
  
  <pre><code>f(Thing("abc"), "123") // prints "123"
  f(Thing("abc"))        // prints "abc"
  </code></pre>
  
  <p>I realise I could make the <code>prop</code> argument an <code>Option[String]</code> and do the check in the function definition, but I was wondering if there was a way around it with the new named/default argument support in 2.8.0.</p>