11.4 Eval
An evaluator is an interactive evaluation context. Each evaluator has its own set of bindings and, potentially, its own set of module declarations. A Rhombus read-eval-print loop (REPL) is backed by an evaluator, for example.
If as_interaction is true, then seq is evaluated as if in a read-eval-print loop. Depending on the bindings of the current evaluator (as determined by Evaluator.current), that can be different that evaluating non-interaction top-level forms.
A suitable evaluator must have been created and installed as the value of the Evaluator.current context parameter, since the default evaluator is empty.
> parameterize { Evaluator.current: Evaluator.make_rhombus() }:
3
annotation | |
function | |
function | |
function | |
|
function | ||||
|
If export_name is #false, then the result is #void. Otherwise, if export_name is a list, then it represents a dotted path (where dots are added) starting with an exported name, or export_name represents an exported name when it is a symbol; either way, the value exported by mod as export_name is returned, or an exception is thrown if no such export is available.
> Evaluator.instantiate(ModulePath'rhombus', #'List)(1)
[1]
> Evaluator.instantiate(ModulePath'rhombus', [#'List, #'length])([1, 3])
2
function | ||
context parameter | |