Next: ABSTAIN and REINSTATE, Previous: STASH and RETRIEVE, Up: Statements [Index]
INTERCAL-72 | C-INTERCAL | CLC-INTERCAL | J-INTERCAL |
---|---|---|---|
yes | all versions | all versions | all versions |
Variables in INTERCAL can be either read-write or
read-only. At the start of a program, all variables are read-write, but
this status can be changed dynamically during execution of a program
using the IGNORE
and REMEMBER
statements
(whose gerunds are IGNORING
and REMEMBERING
respectively). The syntax is the same as for STASH
and
RETRIEVE
: the command’s name followed by an
intersection-separated list of variables. For instance:
DO IGNORE .4 DO REMEMBER ,4 + ;5
Using the IGNORE
statement sets a variable to be read-only
(or does nothing if it’s read-only already);
REMEMBER
sets it to be read-write. Any attempt to assign
to a read-only variable silently fails. One place that this is used is
in the system library; instead of not assigning to a variable in
certain control flow paths, it instead sets it to be read-only so that
subsequent assignments don’t change its value (and sets it to be
read-write at the end, which succeeds even if it was never set
read-only in the first place); the advantage of this is that it
doesn’t need to remember what flow path it’s on except in
the variable’s ignorance status.
The interaction between IGNORE
and RETRIEVE
was never defined very clearly, and is in fact different in
C-INTERCAL, CLC-INTERCAL and
J-INTERCAL; for more details, see RETRIEVE.