Data type of procedure environments
Procedure environments are mostly ephemeral objects and are only rarely seen by the user (and even more rarely useful to examine). A procedure environment represents a procedure that is currently being executed: formal parameters and local variables have values.
Procedure environments do rarely become visible, and you do not need to manipulate them directly. They serve only one purpose: if a procedure is generated inside another procedure, variable names in the body of the inner procedure that are not declared local there refer to names in the outer procedure, provided they are declared local in the outer procedure. (See the Programming Manual for more information on the scoping rules for MuPAD®.) Consequently, the inner procedure must contain information on the current values of local variables of the outer procedure. Hence, the status of the outer procedure is encoded into an object of type DOM_PROC_ENV, and that object is stored in the returned procedure as its twelfth operand.
You never need to generate objects of this type. There are no operations available.
The only occasion on which you should come across a procedure environment is the following: an outer procedure returns an inner procedure depending on formal parameters or local variables of the outer procedure:
outer := proc(x) option escape; begin /* inner procedure to return : */ y -> x + y end_proc: add5 := outer(5)
In spite of the (slightly confusing) output, x has a special meaning here: it points to the parameter x of outer. That parameter currently has the value 5 and won't be changed any more. To be able to access that value, the particular instance of outer in the status of being executed has to be stored in add5:
The number of operands of a procedure environment depends on the number of local and saved variables of the outer procedure. Details about the operands remain undocumented.