William Brew <[EMAIL PROTECTED]> writes:
> Does anyone know how to determine if a symbol has been declared special,
> where this info is
> kept, etc.
DESCRIBE can display this information.
| * (describe '*print-base*)
|
| *PRINT-BASE* is an external symbol in the COMMON-LISP package.
| It is a special variable; its value is 10.
| Special documentation:
| The output base for integers and rationals.
Looking around in target:code/describe.lisp, I see this:
;; Describe the value cell.
(let* ((kind (info variable kind x))
(wot (ecase kind
(:special "special variable")
(:constant "constant")
(:global "undefined variable")
(:macro "symbol macro")
(:alien nil))))
So perhaps a function like this would do the job:
(defun special-variable-p (symbol)
"Return true if SYMBOL has been declared as a special variable."
(eq (extensions:info :variable :kind symbol) ':special))
The EXTENSIONS:INFO macro recognizes its first two arguments by
comparing symbol names (like LOOP does), so the VARIABLE and KIND
symbols can be in any package. I put them in KEYWORD to make it
more obvious that they are not names of lexical variables.
You may want to add an environment parameter to this.