title: Using Scala Toolbox eval, how do I define I value I can use in later evals?
body: <p>I'm using Scala toolbox to eval some Scala code for a web interpreter. It is working well, the code looks like this:</p>
  
  <pre><code>import scala.reflect.runtime.universe._
  import scala.tools.reflect.ToolBox
  
  object Eval {
    val toolbox = runtimeMirror(getClass.getClassLoader).mkToolBox()
  
    def eval[T](code: String): T = {
      toolbox.eval(toolbox.parse(code)).asInstanceOf[T]
    }
  }
  </code></pre>
  
  <p>I can do something like:</p>
  
  <pre><code>Eval.eval[Long]("1 + 1")
  </code></pre>
  
  <p>and get <code>2</code> back. The question comes up when I want to define something:</p>
  
  <pre><code>Eval.eval[Unit]("val yellow = 5")
  Eval.eval[Long]("yellow")
  </code></pre>
  
  <p>I get a <code>not found: value yellow</code> error. How do I define a value that I can use in later evaluations with Scala Toolbox?</p>