pub struct Ctx { /* private fields */ }Expand description
Evaluation context threaded through the tree-walker: includes the unique-id
source for closure identities and the builtin module cache. It does not hold
a module registry or loader; imports are resolved before evaluation
(crate::load_module), and loaded modules are Rc-held values.
Implementations§
Source§impl Ctx
impl Ctx
Sourcepub fn new() -> Self
pub fn new() -> Self
A context with a fresh id source. Used by crate::eval::eval and crate::eval::apply.
Sourcepub fn with_ids(ids: u64) -> Self
pub fn with_ids(ids: u64) -> Self
A context resuming an id source at ids so identities continue from
an earlier context. This is required when a host builds a fresh Ctx per
call but shares values between them (e.g., Python bindings). Without this,
a module’s reserved id block and subsequent closure IDs could alias,
causing __eq to incorrectly identify them as equal. The counter is
carried by value to avoid a pointer chase during closure minting.