diff options
-rw-r--r-- | src/dotty/tools/dotc/repl/REPL.scala | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/repl/REPL.scala b/src/dotty/tools/dotc/repl/REPL.scala index 6fda355b5..1fcb055d6 100644 --- a/src/dotty/tools/dotc/repl/REPL.scala +++ b/src/dotty/tools/dotc/repl/REPL.scala @@ -53,19 +53,31 @@ object REPL { def context(ctx: Context): Context = ctx /** The first interpreted commands always take a couple of seconds due to - * classloading. To bridge the gap, we warm up the interpreter by letting it - * interpret at least a dummy line while waiting for the first line of input - * to be entered. + * classloading. To bridge the gap, we warm up the interpreter by letting + * it interpret at least a dummy line while waiting for the first line of + * input to be entered. */ val initialCommands: List[String] = "val theAnswerToLifeInTheUniverseAndEverything = 21 * 2" :: Nil - /** We also allow the use of setting cleanup commands in the same manner. - * This is mainly due to supporting the SBT options to specify these commands + /** Before exiting, the interpreter will also run the cleanup commands + * issued in the variable below. This is useful if your REPL creates + * things during its run that should be dealt with before shutdown. */ val cleanupCommands: List[String] = Nil - /** We also allow binding initial values */ + /** Initial values in the REPL can also be bound from runtime. Override + * this variable in the following manner to bind a variable at the start + * of the REPL session: + * + * {{{ + * override val boundValues = Array("exampleList" -> List(1, 1, 2, 3, 5)) + * }}} + * + * This is useful if you've integrated the REPL as part of your project + * and already have objects available during runtime that you'd like to + * inspect. + */ val boundValues: Array[(String, Any)] = Array.empty[(String, Any)] /** The default input reader */ |