William Brew writes:
>
> I am working on a language processing application built on top of
> CMUCL. The system
> needs to know if a symbol is the name of a special variable. I have
> been unable to
> find where this information is kept -- looked at the obvious places like
> the plist, tried some
> apropos in the compiler package etc. I would think that there is a
> simple interface somewhere
> that can tell you this.
>
> Does anyone know how to determine if a symbol has been declared special,
> where this info is
> kept, etc.
You can get it from the compiler's info database, with EXT:INFO. If
you're interested in portability, it's possible to get to it portably
(if inefficiently), by trying to create a closure over it. I have a
utility that does just that:
(defun globally-special-p (s)
;; Try to make a closure over S and return T if it won't close.
(eval `(let ((maybe-closure (let ((,s nil))
(lambda () ,s))))
(let ((,s t))
(declare (ignorable ,s))
(funcall maybe-closure)))))
#+cmu
(defun globally-special-p (s)
(eql (ext:info :variable :kind s) :special))
#+sbcl
(defun globally-special-p (s)
(eql (sb-int:info :variable :kind s) :special))
--
/|_ .-----------------------.
,' .\ / | No to Imperialist war |
,--' _,' | Wage class war! |
/ / `-----------------------'
( -. |
| ) |
(`-. '--.)
`. )----'