Skip to content

Instantly share code, notes, and snippets.

@labra
Created August 30, 2013 08:05
Show Gist options
  • Save labra/6387424 to your computer and use it in GitHub Desktop.
Save labra/6387424 to your computer and use it in GitHub Desktop.
REPL loop in Scala
import scala.tools.nsc.Settings
import scala.tools.nsc.interpreter.ILoop
object TestConsole extends App {
val settings = new Settings
settings.usejavacp.value = true
settings.deprecation.value = true
new SampleILoop().process(settings)
}
class SampleILoop extends ILoop {
override def prompt = "==> "
addThunk {
intp.beQuietDuring {
intp.addImports("java.lang.Math._")
}
}
override def printWelcome() {
echo("\n" + " Wellcome to a simple REPL ")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment