Skip to main content

Module scope

Module scope 

Source
Expand description

Lexical and runtime context shared across evaluation steps.

Scope is the single carrier of evaluator state: it walks down through the AST, threads imported bindings, anchors &root/&sibling lookups, and holds the lazy-evaluation thunk table. It is wrapped in Arc everywhere so children can be derived cheaply via Scope::child and friends.

Structs§

ListContext
Iteration context for &prev / &next / &index references inside a list.
RootRef
Anchor for &root lookups in a Scope.
Scope
Single environment frame. Cheap to derive (every field is either Clone or Arc-shared) and wrapped in Arc<Scope> at every call site so backtracking through parent stays copy-free.
Thunk
A lazily-evaluated dict entry. The first access through Evaluator::force_thunk parses + evaluates node against scope and caches the result in value; later accesses return the cached value.

Type Aliases§

Locals
Type alias for the bindings table. Wrapped in Mutex so concurrent host evaluators sharing a Scope across threads stay safe; the inner HashMap starts empty (zero-capacity, no heap allocation) and only grows when something actually writes a binding.
Thunks
Type alias for the thunks table — same shape as Locals.