title: Scala - How to compile code from an external file at runtime?
body: <p>I want to design a Scala program that accepts Scala files as parameters which can customize the execution of the program.  In particular, I want to supply at runtime files that contain implementations of methods that will be invoked by the program.  How can I properly depend on external files and invoke their methods dynamically at runtime?  Ideally, I would also like those files to be able to depend on methods and classes in my program.</p>
  
  <p>Example Scenario: I have a function that contains the line <code>val p: Plant = Greenhouse.getPlant()</code>, and the <code>Greenhouse</code> class with the <code>getPlant</code> method is defined in one of the files that will be supplied at runtime.  In that file, the method <code>getPlant</code> returns a <code>Rose</code>, where <code>Rose &lt;: Plant</code> and <code>Plant</code> is defined in the original program.  How do I achieve (or approximate) this interdependency, assuming the files are only joined at runtime and not at compile-time?</p>