Protecting variables



(1) Put the following in file called protect.lisp.

-----start------------------------

(defun $protect (x)
  (if (atom x)
      (putprop x 'neverset 'assign)
    (merror "Argument to protect must be an atom")))

(defun $unprotect (x)
  (if (atom x) (remprop x 'assign)
    (merror "Argument to unprotect must be an atom")))

----end--------------------------


(2) From a Maxima prompt, load it with the command  (you may need to use
a full pathname)

(C1) load("protect.lisp");
(D1)                            l:/protect.lisp
(C2) protect(a);
(D2)                               NEVERSET
(C3) a : 5;
Improper value assignment to a
 -- an error.  Quitting.  To debug this try DEBUGMODE(TRUE);)
(C4) unprotect(a);
(D4)                                 TRUE
(C5) a : 5;
(D5)                                   5
(C6) 
Barton