Skip to main content

pre_eval_delayed_assign

Function pre_eval_delayed_assign 

Source
fn pre_eval_delayed_assign(
    args: &[Arg],
    env: &Environment,
    context: &BuiltinContext<'_>,
) -> Result<RValue, RError>
Expand description

delayedAssign(x, value, eval.env, assign.env) — create a promise binding.

The variable x is bound as a promise in assign.env. When first accessed, value is evaluated in eval.env and the result cached.

This is the core mechanism behind rlang’s on_load() system.

@param x character: variable name to bind @param value expression (unevaluated) to evaluate on first access @param eval.env environment for evaluating value (default: parent.frame()) @param assign.env environment to bind in (default: parent.frame()) @return NULL (invisibly) @namespace base