The Global Environment Object (.environment)

The environment object .environment is a directory (an instance of the Rexx Directory class) of public objects that are always accessible throughout the whole process. Each entry in this directory can itself be referred to by an environment symbol that starts with a dot, immediately followed by its index name. All the public Rexx built-in classes are stored in the environment directory .environment, therefore the public Rexx array class can be fetched by its environment symbol .ARRAY or alternatively with .environment~array. To place something in the environment directory, you use the form:

.environment~your.object = value

Include a period ( .) in any index name you use, to avoid conflicts with current or future Rexx entries to the environment directory .environment. In the above example the index name used for storing value within the environment directory is YOUR.OBJECT. To retrieve the valuestored with the index name YOUR.OBJECT from the .environment directory, you use one of the following two forms:

say .environment~your.object
say .your.object /* same as above */

The scope of .environment is the current process, which means it is shared among all interpreter instances executing in this process.

You use an environment symbol to access the entries of this directory. An environment symbol starts with a period and has at least one other character, and the symbol is not a valid numeric value. You have seen environment symbols earlier; for example in:

asav = .savings~new

.savings is an environment symbol, and refers to the Savings class. The classes you create can be referenced with an environment symbol. There is an environment symbol for each public Rexx-defined class, as well as for each of the unique environment objects this section describes, such as The Nil Object.