Skip to content

Instantly share code, notes, and snippets.

@retronym
Created April 29, 2012 17:04
Show Gist options
  • Save retronym/2551948 to your computer and use it in GitHub Desktop.
Save retronym/2551948 to your computer and use it in GitHub Desktop.
interpreter result
scala> val intp = new scala.tools.nsc.interpreter.IMain
intp: scala.tools.nsc.interpreter.IMain = scala.tools.nsc.interpreter.IMain@6875577e
scala> val holder = new scala.runtime.ObjectRef[Any]
holder: scala.runtime.ObjectRef[Any] = ()
scala> intp.bind("holder", "scala.runtime.ObjectRef[Any]", holder)
holder: scala.runtime.ObjectRef[Any] = ()
res16: scala.tools.nsc.interpreter.IR.Result = Success
scala> intp.interpret("holder.elem = {1 + 2}")
holder.elem: Any = 3
res17: scala.tools.nsc.interpreter.IR.Result = Success
scala> holder.elem
res18: Any = 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment