Martin wrote -
There are four cases in which 'Unbind' can currently be used.
1) To unbind a component of a list.
2) To unbind a component of a record.
3) To unbind a global variable.
4) To unbind a local variable.The GAP manual mentions only the usages 1) and 2). Those are supported
now, and will always be supported, since they are the whole reason for
having 'Unbind' at all.Usage 3) is probably what Gene meant with ``temporary global variables''.
This usage is supported now and will be supported by future GAP versions.Usage 4) is supported now, but will probably not be supported by future
versions of GAP. But this is probably not important, since reusing a
local variable for different purposes in a function is not a good idea.
While it isn't vital, can I express a mild preference for retaining
4 for the following reason. Suppose I have a loop that goes
for ..... do
x := <very large object>; <do stuff with x> # I am finished with x now <do other large stuff not involving x> od;
then I would use Unbind(x) at the point where the comment is
to free up the workspace for the "other large stuff". I could do it
with x := 1; (say), but it is less clear what I am doing.
As I said a mild preference, but when one deals with individual
large objects it is important to be able to release the storage as
soon as possible.
Steve