Possible Duplicate:
“eval” in Scala
I know scala is a compiled language, but I do also know that I can dynamically load classes into the jvm, and I can call the scala compiler at runtime, last but not least I do also have an awesome repl, so having scala as a scripting language should be possible.
so there are some tasks I need to get to run:
simple interpret:
val src = """ println("Hello World") """
interpret(src)
call external functions:
object A{
def foo =
println("Hello World")
}
val src = """ A.foo """
interpret(src)
implement functionality:
trait T{
def foo:String
}
val src = """ class A extends T{ def foo = "Hello World" } """
interpret(src)
val t = loadClassAndCreatInstance.asInstanceOf[T]
println(t.foo)
it would be great to get a solution to all my problems.