up previous next

protect a variable from being overwritten

protect X;
protect X : reason;
  where reason: STRING

This command protects the variable X from being assigned to. Attempting to assign to it will produce an error; if a reason (STRING) was given it is printed in the error message.

/**/  MaxSize := 99;
/**/  protect MaxSize : "size limit for fast computation";
-- /**/  MaxSize := 1000; --> !!! ERROR !!! as expected
ERROR: Cannot set "MaxSize" (size limit for fast computation)

/**/  unprotect MaxSize;  --> remove protection, X may be assigned to now
/**/  MaxSize := 1000; --> OK

See Also