title: Implement companion object / factory in a separate submodule
body: <p>In my <code>core</code> sbt module, I have an trait <code>Matrix</code> for a matrix data type, and a trait <code>MatrixInstance</code> that has some factory methods. The companion object is supposed to extend this trait.</p>
  
  <p>In a separate sbt submodule <code>implementation1</code>, I would like to implement this</p>
  
  <pre class="lang-scala prettyprint-override"><code>object Matrix extends MatrixInstance { ... }
  </code></pre>
  
  <p>companion. </p>
  
  <p>The idea here is that if I decide to have a second implementation, the library user could just change his <code>libraryDependencies += ...</code> from <code>implementation1</code> to <code>implementation2</code>.</p>
  
  <p>However, this doesn't seem to work. i.e. it looks like an object and it's companion must reside in the same module (file?). Otherwise I get circular dependencies and scalac fails.</p>
  
  <p>Is there any pattern I can use to achieve this functionality? i.e. define the interface trait for the factory/companion object, have it implemented in a separate artifact, and then allow the user to choose between the implementations by only changing <code>libraryDependencies</code>?</p>