DOM_PROC_ENV
-- the data
type of procedure environmentsA 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 for 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
the outer procedure, provided they are declared local in the outer
procedure. (see the Programming Manual for more information on
MuPAD 's scoping rules .) Consequently, the inner procedure must
contain information on the current values of local variables of the
outer procedure. Hence, the status of 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.
Evaluating an object of type DOM_PROC_ENV
returns
itself.
Calling a procedure environment as a function gives the procedure environment itself, regardless of the arguments. The arguments are not evaluated.
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.
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)
y -> x + y
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
:
>> op(add5, 12)
DOM_PROC_ENV(5667160)
DOM_PROC_ENV
have no mathematical meaning; they denote
positions in memory.