pub fn env_push(env: &Env, val: Val) -> EnvExpand description
Push a value onto a borrowed environment, returning a new Env.
The input env is borrowed, so we always need at least one Rc::clone
to obtain an owning handle. If anyone else holds a reference to the
underlying Vec<Val> (refcount > 1 after the clone), Rc::make_mut
will clone the vector for copy-on-write semantics — this is the common
case where a parent closure or a sibling kont frame is also looking at
the same env.
Prefer env_push_owned when the caller has unique ownership of the
Env and is about to discard it (e.g. inside Cont::LetBody after
the cont has been popped) — that path avoids the redundant Rc::clone
and, when refcount is 1, mutates the vector in place.