From: Richard Fateman <fateman at cs>
I don't know exactly how you ended up in the particular bug stage,
but (let ((P (make-array ...)) ... (aref P i) should use the local
P regardless of any special variable named P. If you are using
the array P "nonlocally" then you must declare YOUR P to be
special.
Richard, this analysis isn't quite right.
If the variable P has been declaimed special by a DECLAIM, PROCLAIM,
DEFVAR, DEFPARAMETER, or DEFCONSTANT [?], then all bindings thereafter
will be special bindings. It is true that in
(let ((P (make-array ...)) ... (aref P i)
the code inside the let will see the binding established by that let,
the binding will nonetheless be as a special, not a lexical. That
means any other references to P dynamically inside that let will see
the binding (and not the possibly-unrelated outer value of P), that
the value of the binding may be changed by intervening code (that
might not be lexically visible), and that intervening code could even
interpose additional bindings.
(let ((P (make-array ...))) (foo #'(lambda () ... (aref p ...))))
(defun foo (continuation) (let ((p 22/7)) (funcall continmuation)))
or
(defun foo (continuation) (setq p 22/7) (funcall continmuation))
Also, if there were some other code in Maxima that relies on seeing
some unrelated global value of P, that code would misbehave if called
anywhere inside the let binding.
All this is why modern lisp programmers avoid special variables.