title: dynamically create class in scala, should I use interpreter?
body: <p>I want to create a class at run-time in <em>Scala</em>. For now, just consider a simple case where I want to make the equivalent of a <em>java</em> bean with some attributes, I only know these attributes at run time.</p>
  
  <p>How can I create the scala class? I am willing to create from scala source file if there is a way to compile it and load it at run time, I may want to as I sometimes have some complex function I want to add to the class. <em>How can I do it?</em></p>
  
  <p>I worry that the scala interpreter which I read about is sandboxing the interpreted code that it loads so that it won't be available to the general application hosting the interpreter? If this is the case, then I wouldn't be able to use the dynamically loaded scala class.</p>
  
  <p>Anyway, the question is, how can I dynamically create a scala class at run time and use it in my application, best case is to load it from a scala source file at run time, something like <code>interpreterSource("file.scala")</code> and its loaded into my current runtime, second best case is some creation by calling methods <em>ie.</em> <code>createClass(...)</code> to create it at runtime.</p>
  
  <p>Thanks, Phil</p>