previous  next
Destroy
Syntax
Destroy R_1, ... , R_n

where each R_i is the identifier of a ring.
Summary
delete rings
Description
This command clears all global variables bound to the listed rings.
Moreover, if R is a ring in the list and there are no variables in the
current memory dependent upon R, then the ring identified by R is
deleted; otherwise R is renamed with a name of the form 'R#N' where N
is an integer.  This renamed ring is automatically removed as soon as
the last variable dependent upon it is deleted.

The command will not work if one of the listed rings is the current
ring.

For more information about memory in CoCoA, see the chapter entitled
"Memory Management."

Example

Use R ::= Q[x,y,z];
X := 3;
I := Ideal(x,y);  -- dependent on R
ENV.R.Y := 5;  -- in global memory bound to R
Use S ::= Q[a,b];
Destroy R;
RingEnvs();  -- R#1 created to hold because of the ideal I
["Q", "Qt", "R#1", "S", "Z"]
-------------------------------
Memory();  -- ENV.R.Y was destroyed along with R
["I", "It", "X"]
-------------------------------
I;  -- I was not destroyed
R#1 :: Ideal(x, y)
-------------------------------
I := 3;  -- overwrite I; it is no longer dependent on a CoCoA ring
Describe Memory();
------------[Memory]-----------
I = 3
It = R#1 :: Ideal(x, y)
X = 3
-------------------------------
RingEnvs();  -- subtle point here: the variable 'It' is still dependent
             -- on R#1
["Q", "Qt", "R#1", "S", "Z"]
-------------------------------
RingEnvs();  -- However, the previous command caused It to becomed a
             -- string; hence, R#1 disappears.
["Q", "Qt", "S", "Z"]
-------------------------------
See also: