env_poke() will assign or reassign a binding in
FALSE and a binding does not already
exists, an error is issued.
env_poke(env = caller_env(), nm, value, inherit = FALSE, create = !inherit)
Names of bindings.
The value for a new binding.
Whether to look for bindings in the parent environments.
Whether to create a binding if it does not already exist in the environment.
The old value of
nm or a zap sentinel if the
binding did not exist yet.
TRUE, the parents environments are checked for
an existing binding to reassign. If not found and
TRUE, a new binding is created in
env. The default value for
create is a function of
FALSE when inheriting,
This default makes sense because the inheriting case is mostly
for overriding an existing binding. If not found, something
probably went wrong and it is safer to issue an error. Note that
this is different to the base R operator
<<- which will create
a binding in the global environment instead of the current
environment when no existing binding is found in the parents.
env_poke() is experimental. We are still experimenting with
reducing the number of redundant functions by using quasiquotation.
It is possible
env_poke() will be deprecated in favour of
env_bind() and name-unquoting with