Skip to main content

interp_reg_finalizer

Function interp_reg_finalizer 

Source
fn interp_reg_finalizer(
    args: &[RValue],
    named: &[(String, RValue)],
    context: &BuiltinContext<'_>,
) -> Result<RValue, RError>
Expand description

Register a function to be called when an environment is garbage collected, or at interpreter exit if onexit = TRUE.

Since miniR uses Rc-based environments (no tracing GC), finalizers with onexit = FALSE are accepted silently but will never fire. When onexit = TRUE, the finalizer is stored on the Interpreter and executed during its Drop.

@param e an environment to attach the finalizer to @param f a function of one argument (the environment) to call @param onexit logical; if TRUE, run the finalizer at interpreter exit @return NULL, invisibly