Tower

Struct Tower 

Source
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

Source

pub fn load() -> Result<Tower, Fault>

Source

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.

Source

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.

Source

pub fn get(&mut self, name: &str) -> Result<Val, Fault>

One entry of the evaluator’s export selector.

Source

pub fn eval(&mut self, prog: &Val) -> Result<Val, Fault>

Source

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.

Source

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.

Source

pub fn compile_under(&mut self, m: &Val, prog: &Val) -> Result<Val, Fault>

As Tower::compile, but under a given interpreter.

Source

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.

Source

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.

Source

pub fn repl(&mut self) -> Result<Val, Fault>

It reads its lines by calling ('host stdin), so what it needs from a caller is a console to register and one message to start it.

Source

pub fn locker(&mut self) -> Result<Val, Fault>

A script rather than a task because it runs once and ends, which is the shape a file gets and the same message starts it.

Auto Trait Implementations§

§

impl Freeze for Tower

§

impl !RefUnwindSafe for Tower

§

impl Send for Tower

§

impl Sync for Tower

§

impl Unpin for Tower

§

impl !UnwindSafe for Tower

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.