Skip to main content

with_eval_context

Function with_eval_context 

Source
pub fn with_eval_context<F, R>(f: F) -> Result<R, EvalError>
where F: FnOnce(&mut Env) -> Result<R, EvalError>,
Expand description

Call a Clojure-callable Value with the given arguments.

This can be called from any Rust code running inside an active evaluation (i.e., inside a builtin function, a Thunk::force, etc.).

§Errors

Returns Err if called outside an eval context, or if the callee raises an error. Execute a closure with access to a temporary Env constructed from the current eval context.

This is used by the IR interpreter for calling builtins that need an Env (e.g., for nested apply_value calls from inside a NativeFunction closure).

§Errors

Returns Err if called outside an eval context.