Skip to content

Commit 5c29e0a

Browse files
committed
Add documentation to REPL
1 parent d4d9009 commit 5c29e0a

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/dotty/tools/dotc/repl/REPL.scala

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,31 @@ object REPL {
5353
def context(ctx: Context): Context = ctx
5454

5555
/** The first interpreted commands always take a couple of seconds due to
56-
* classloading. To bridge the gap, we warm up the interpreter by letting it
57-
* interpret at least a dummy line while waiting for the first line of input
58-
* to be entered.
56+
* classloading. To bridge the gap, we warm up the interpreter by letting
57+
* it interpret at least a dummy line while waiting for the first line of
58+
* input to be entered.
5959
*/
6060
val initialCommands: List[String] =
6161
"val theAnswerToLifeInTheUniverseAndEverything = 21 * 2" :: Nil
6262

63-
/** We also allow the use of setting cleanup commands in the same manner.
64-
* This is mainly due to supporting the SBT options to specify these commands
63+
/** Before exiting, the interpreter will also run the cleanup commands
64+
* issued in the variable below. This is useful if your REPL creates
65+
* things during its run that should be dealt with before shutdown.
6566
*/
6667
val cleanupCommands: List[String] = Nil
6768

68-
/** We also allow binding initial values */
69+
/** Initial values in the REPL can also be bound from runtime. Override
70+
* this variable in the following manner to bind a variable at the start
71+
* of the REPL session:
72+
*
73+
* {{{
74+
* override val boundValues = Array("exampleList" -> List(1, 1, 2, 3, 5))
75+
* }}}
76+
*
77+
* This is useful if you've integrated the REPL as part of your project
78+
* and already have objects available during runtime that you'd like to
79+
* inspect.
80+
*/
6981
val boundValues: Array[(String, Any)] = Array.empty[(String, Any)]
7082

7183
/** The default input reader */

0 commit comments

Comments
 (0)