Evaluates files, strings, or input streams as Scala code, and returns the result.
Evaluates files, strings, or input streams as Scala code, and returns the result.
If target
is None
, the results are compiled to memory (and are therefore ephemeral). If
target
is Some(path)
, the path must point to a directory, and classes will be saved into
that directory.
Eval also supports a limited set of preprocessors. Currently, "limited" means "exactly one":
directives of the form #include <file>
.
The flow of evaluation is:
- extract a string of code from the file, string, or input stream
- run preprocessors on that string
- wrap processed code in an apply
method in a generated class
- compile the class
- contruct an instance of that class
- return the result of apply()