pub struct Tower { /* private fields */ }Expand description
A loaded evaluator and the heap it runs in; two towers do not share cells.
The interpreter and environment are held here rather than in the evaluator
because both accumulate: the prelude pushes a frame onto env, and an
alteration replaces m.
Implementations§
Source§impl Tower
impl Tower
pub fn load() -> Result<Tower, Fault>
Sourcepub fn call(&mut self, f: &Val, args: &[Val]) -> Result<Val, Fault>
pub fn call(&mut self, f: &Val, args: &[Val]) -> Result<Val, Fault>
Apply a value from this tower to arguments built outside it. A live value
with no source form rides in as Exp::Proc, the carrier cross-stage
persistence uses.
Sourcepub fn run_source(&mut self, src: &str) -> Result<Val, Fault>
pub fn run_source(&mut self, src: &str) -> Result<Val, Fault>
What a module load amounts to, and how a value written outside the evaluator - an interpreter mutation, say - gets inside it.
Sourcepub fn get(&mut self, name: &str) -> Result<Val, Fault>
pub fn get(&mut self, name: &str) -> Result<Val, Fault>
One entry of the evaluator’s export selector.
pub fn eval(&mut self, prog: &Val) -> Result<Val, Fault>
Sourcepub fn eval_under(&mut self, m: &Val, prog: &Val) -> Result<Val, Fault>
pub fn eval_under(&mut self, m: &Val, prog: &Val) -> Result<Val, Fault>
The environment is this tower’s either way: an alteration changes what the forms mean, not what is in scope.
Sourcepub fn compile(&mut self, prog: &Val) -> Result<Val, Fault>
pub fn compile(&mut self, prog: &Val) -> Result<Val, Fault>
The residual of a program, without running it. Staging leaves its bindings in the heap’s open block and hands back only the variable naming the result, so closing the block is this caller’s job.
Sourcepub fn compile_under(&mut self, m: &Val, prog: &Val) -> Result<Val, Fault>
pub fn compile_under(&mut self, m: &Val, prog: &Val) -> Result<Val, Fault>
As Tower::compile, but under a given interpreter.
Sourcepub fn task(&mut self, prog: &Val) -> Result<Val, Fault>
pub fn task(&mut self, prog: &Val) -> Result<Val, Fault>
The floor closure a scheduler starts, evaluating prog with the task’s
own address bound to self. Nothing of this tower’s heap goes with it,
so the task runs in the heap that spawned it.
Sourcepub fn script(&mut self, forms: &[Val]) -> Result<Val, Fault>
pub fn script(&mut self, forms: &[Val]) -> Result<Val, Fault>
A file, as the entry point of a task. The forms become the body of a
thunk the prelude’s script runs once, so a sequence of definitions
ending in an expression still gets the loop an RPC needs. Nothing starts
until a message arrives: the invocation is a message like any other.