Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Embedding REPL in 2.8 working around classpath propagation changes.
object IntepreterFix {
import Interpreter._
def break(args: DebugParam[_]*): Unit = {
val intLoop = new InterpreterLoop
intLoop.settings = {
val s = new Settings(Console.println)
// need to pass this explicitly to the settings for Scalac.
// See:
s.classpath.value = System.getProperty("java.class.path")
intLoop.createInterpreter = InteractiveReader.createDefault(intLoop.interpreter)
// rebind exit so people don't accidentally call System.exit by way of predef
intLoop.interpreter.beQuietDuring {
intLoop.interpreter.interpret("""def exit = println("Type :quit to resume program execution.")""")
for (p <- args) {
intLoop.interpreter.bind(, p.typeStr, p.param)
println("%s: %s".format(, p.typeStr))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment