title: Scala optional default arguments
body: <p>Say I have a Scala class with default arguments</p>
  
  <pre><code>class MyClass(p1: Int = 0, p2: Int = 1)
  </code></pre>
  
  <p><code>p1</code> and <code>p2</code> comes from optional query string parameters in a Play app, e.g.,</p>
  
  <pre><code>http://mysite.com/blah?p1=10&amp;p2=20 
  </code></pre>
  
  <p>In the Play controller action, I am trying to figure out a way to dynamically construct an argument lists when calling <code>MyClass</code> depending on what's passed in the url. For example, there may be no arguments passed at all in which case I would call <code>new MyClass</code>, if <code>p1</code> is passed, then I would call <code>new MyClass(p1)</code> where p1 is extracted from the url query parameter, you get the idea. </p>
  
  <p>How can I do this without hard coding the list of arguments as I might add additional optional parameters in the future. Is it possible to construct a <code>Map</code>-like object with named arguments to pass as the arguments list or something like that?</p>