You can use power mode to access the REPL reader; it will give you a fully working readLine :
scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** ** :phase has been set to 'typer'. ** ** scala.tools.nsc._ has been imported ** ** global._, definitions._ also imported ** ** Try :help, :vals, power.<tab> ** scala> repl.in.readLine("enter something: ") enter something: hello world res0: String = hello world scala>
Edit : as pointed out by @ som-snytt, in 2.11 you can use reader instead of repl.in in the code above, which is shorter and easier to remember.
gourlaysama
source share