up previous next

Ring-Bound Memory

A variable prefixed by MEMORY.ENV.R where R is the identifier of a ring, becomes bound to the ring R. This means that when R ceases to exist, so does the variable (unlike variables that are part of the working memory, labeled by R: see "Working Memory", above). The collection of these variables comprises the *ring-bound memory.* The variables bound to a ring R can be listed with the command Memory(R). Note that since ring-bound variables are, in particular, prefixed by MEMORY, they are also part of the global memory discussed in the previous section.

Most users will never need ring-bound variables. Their main use is within functions which need to define and use rings temporarily, destroying them (along with their variables) before returning.

The prefix ENV is shorthand for MEMORY.ENV.

example

    
Use R ::= Q[x,y,z];
X := Ideal(x,y);  -- a variable in the current memory
ENV.R.Y := "bound to R";  -- a variable in the memory bound to R
Use S ::= Q[a,b];
Z := 6;
Memory();  -- the working memory
["X", "Z"]
-------------------------------
Memory(R);  -- the memory bound to R 
["Y"]
-------------------------------
Destroy R;
Memory();
["It", "X", "Z"]
-------------------------------
X;  -- Since X is not in the ring-bound memory of R, 
    -- it is not destroyed.  It was *dependent* on the ring R,
    -- so the base ring of R has been given the new name R#5.
R#5 :: Ideal(x, y)
-------------------------------
ENV.R.Y;  -- this variable was destroyed along with R
ERROR: Unknown record field R
CONTEXT: ENV.R.Y
-------------------------------
RingEnvs();
["Q", "Qt", "R#5", "S", "Z"]
-------------------------------