I'm experimenting with interpreting strings in Scala to define classes and methods. I used the example from http://scala-programming-language.1934581.n4.nabble.com/Compiling-a-Scala-Snippet-at-run-time-td2000704.html in the following code:
import scala.tools.nsc.{Interpreter,Settings}
var i = new Interpreter(new Settings(str => println(str)))
i.interpret("class Test { def hello = \"Hello World\"}")
It works, but somehow the intepretation results are not happening at the global namespace:
new Test # => <console>:5: error: not found: type Test
Therefore: How to execute interpreter statements so that the results are defined in the global scope? I'm using scala2.7.7final currently, and can't change the interpreter to 2.8.
Thanks for your help
Matthias