package dotty.tools.dotc.repl

Constructors

Members

A class loader that loads files from a [[scala.tools.nsc.io.AbstractFile]].

A class loader that loads files from a [[scala.tools.nsc.io.AbstractFile]].

[+] class AmmoniteReader

An interpreter for Scala code which is based on the dotc compiler.

The overall approach is based on compiling the requested code and then using a Java c...

An interpreter for Scala code which is based on the dotc compiler.

The overall approach is based on compiling the requested code and then using a Java classloader and Java reflection to run the code and access its results.

In more detail, a single compiler instance is used to accumulate all successfully compiled or interpreted Scala code. To "interpret" a line of code, the compiler generates a fresh object that includes the line of code and which has public definition(s) to export all variables defined by that code. To extract the result of an interpreted line to show the user, a second "result object" is created which imports the variables exported by the above object and then exports a single definition named "result". To accommodate user expressions that read from variables or methods defined in previous statements, "import" statements are used.

This interpreter shares the strengths and weaknesses of using the full compiler-to-Java. The main strength is that interpreted code behaves exactly as does compiled code, including running at full speed. The main weakness is that redefining classes and methods is not handled properly, because rebinding at the Java level is technically difficult.

[+] final object CompilingInterpreter

Utility methods for the Interpreter.

Utility methods for the Interpreter.

[+] class ConsoleWriter

A Writer that writes onto the Scala Console.

A Writer that writes onto the Scala Console.

[+] final object InteractiveReader

The current Scala REPL know how to do this flexibly.

The current Scala REPL know how to do this flexibly.

[+] trait InteractiveReader

Reads lines from an input stream

Reads lines from an input stream

[+] final object Interpreter

This object defines the type of interpreter results

This object defines the type of interpreter results

[+] trait Interpreter

The exported functionality of the interpreter

The exported functionality of the interpreter

[+] class InterpreterLoop

The interactive shell. It provides a read-eval-print loop around the Interpreter class. After instantiation, clients should call the run method.

The interactive shell. It provides a read-eval-print loop around the Interpreter class. After instantiation, clients should call the run method.

[+] final object Main

The main entry point of the REPL

The main entry point of the REPL

[+] final object ManifestInfo
[+] class NewLinePrintWriter
[+] class REPL

A compiler which stays resident between runs. Usage:

scala dotty.tools.dotc.Resident

dotc> "more options and files to compile"

...

dotc> :reset // reset...

A compiler which stays resident between runs. Usage:

scala dotty.tools.dotc.Resident

dotc> "more options and files to compile"

...

dotc> :reset // reset all options to the ones passed on the command line

...

dotc> :q // quit

[+] final object REPL
[+] class SimpleReader

Reads using standard JDK API

Reads using standard JDK API