title: Evaluate string command in Scala from REPL
body: <p>Is there a way to evaluate a arbitrary string from Scala as if the same text was entered into the Scala REPL directly?  I mean, I would like to do something like this:</p>
  
  <pre><code>scala&gt; eval("val x = 42")
  
  scala&gt; x
  res2: Int = 42
  </code></pre>
  
  <p>Since the Scala REPL is accepting commands in an eval loop using jline (I believe) and then compiling/interpreting it, there has to be a way to submit an arbitrary line of text. I am willing to hack the Scala REPL if necessary.</p>