Today I got in a situation where I thought I had declared a
particular symbol to be special, by means of DEFVAR most likely,
but was getting strange behaviour related to it. I wanted to
diagnose the problem by first learning whether the symbol had been
proclaimed special or not. I first looked on the property list of
that symbol, but there was nothing there at all, no SPECIAL flag or
anything like that. I then spent a half hour searching through
CLtL1 without finding any predicate that tells whether a symbol is
special (already) or not. I checked the HyperSpec and couldn't find
any such predicate there either. Then suddenly I remembered
DESCRIBE, which printed out among other things:
It is a special variable; no current value.
OK, so I should have thought of that first. But there's no SPECIALP
predicate or anything else I can find. How does DESCRIBE know that
the symbol is special? How does the JIT compiler built into the
REP loop know that it's special when it's deciding whether to do
lexical or special bindings? If I ever want to automate the
checking of several symbols to see if I forgot to proclaim any of
them special, how can I do that, except by binding standard output
to a string-output-string and calling DESCRIBE in that context and
then parsing the resultant string of output from DESCRIBE??
This is in CMUCL, if it makes any difference. I'm hoping for some
ANSI-CL function (predicate) rather than a CMUCL-specific function
(predicate), but I'm curious in any case.


|