title: Scala passing in traits as parameters to be mixed in
body: <p>I have (for lack of a better term) a factory method that encapsulates constructing an object:</p>
  
  <pre><code>def createMyObject = new SomeClass(a, b, c, d)
  </code></pre>
  
  <p>Now, depending on the context, I will need to mix in one or more traits into SomeClass:</p>
  
  <pre><code>new SomeClass with Mixin1
  </code></pre>
  
  <p>or</p>
  
  <pre><code>new SomeClass with Mixin2 with Mixin3
  </code></pre>
  
  <p>Instead of creating multiple separate factory methods for each "type" of instantiation, how can I pass in the traits to be mixed in so that it can be done with a single method? Or perhaps there is a good pattern for this that is structured differently?</p>
  
  <p>I'd like to maintain the encapsulation so I'd rather not have each consumer just create the class on its own.</p>