EnvironmentRedirect behaves like an Environment that redirects access (put(key, val)
, or ~key
) and assignment (at(key)
, or ~key = val
). It is used as a base class for redirecting Environments. For example uses, see LazyEnvir and ProxySpace.
Create new environment redirect, if envir is passed, it is used as a basis.
EnvironmentRedirect implements some of the interface of Environment
return or replace the source environment
Overriding these methods, one can redirect where objects go when they are assigned to the space. This is done for example in LazyEnvir and ProxySpace.
A function or object that is called when the environment is modified. The key and the changed object are passed as arguments. When an object is removed from the environment, dispatch is called with its key and nil
. Note that dispatch is called on removal only if the removed object existed.
EnvironmentRedirect implements some of the interface of Environment, which it can replace where needed.
EnvironmentRedirect and its subclasses can be used to dispatch assignment, e.g. over a network. To do this, a dispatch function can be supplied - see Public in JITLibExtensions quark. The following local methods can be used to avoid a recursive updating:
Like put
, but without calling the dispatch function.
Like removeAt
, but without calling the dispatch function.