Classes | Libraries > JITLib > Environments | Collections > Unordered | Live Coding

EnvironmentRedirect : Object

base class for environment redirects
Subclasses: LazyEnvir

Description

Environment that redirects access (put) and assignment (at). It is used as a base class for redirecting Environments. For example uses, see LazyEnvir and ProxySpace.

Class Methods

EnvironmentRedirect.new(envir)

Create new environment redirect, if envir is given, it is used as a basis.

replacing Environment class methods

EnvironmentRedirect implements some of the interface of Environment

EnvironmentRedirect.push

EnvironmentRedirect.pop

EnvironmentRedirect.make(function)

EnvironmentRedirect.use(function)

Inherited class methods

Undocumented class methods

EnvironmentRedirect.newFrom(aCollection)

Instance Methods

.envir

.envir = argEnvir

return or replace the source environment

e = LazyEnvir.new;
e.put(\x, 9);
e.envir; // look into the envir itself: for a LazyEnvir it contains Maybe as placeholders

redirecting objects

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.

.at(key)

.put(key, obj)

.localPut(key, obj)

.removeAt(key)

.dispatch

.dispatch = disp

A function or object that is called when the environment is modified. The key and the changed object are passed as arguments.

e = LazyEnvir.new;
e.dispatch = { |key, val| [key, val].postln };
e.put(\x, 9);

.add(anAssociation)

add an association

replacing Environment instance methods

EnvironmentRedirect implements some of the interface of Environment, which it can replace where needed.

.push

.pop

.clear

.choose

.make(function)

.use(function)

.do(function)

.keysValuesDo(function)

.sortedKeysValuesDo(function)

.keysValuesArrayDo(argArray, function)

.findKeyForValue(val)

.know

.know = flag

.doesNotUnderstand(selector ... args)

Inherited instance methods

Undocumented instance methods

.doFunctionPerform(selector, args)

.linkDoc(doc, pushNow: true)

.putAll( ... dictionaries)

.unlinkDoc(doc, popNow: false)

Networking

EnvironmentRedirect and its subclasses can be used to dispatch assignment over a network. To do this, a dispatch function can be supplied - see Public in JITLibExtensions quark.