[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Finding out if a variable is proclaimed special
- To: tar@ISI.EDU
- Subject: Re: Finding out if a variable is proclaimed special
- From: "Mark A. Tapia" <email@example.com>
- Date: Tue, 17 Aug 1993 09:32:34 -0400
- Cc: firstname.lastname@example.org
On Mon Aug 16 at 20:04:25 Thomas A. Russ writes:
> I am wondering how (in MCL, not necessarily portably) to determine if
> a variable is proclaimed special.
The function proclaimed-special-p will determine whether the variable
? ? (defparameter *c* 1)
? (proclaimed-special-p '*c*)
? (proclaimed-special-p 'an-undeclared-variable)
In the example, replacing defparameter by defvar has the same effect.
Note: It is standard practice to denote special variables by beginning
and ending them with an asterisk. This way the "special" variables standout.
For example, all of the 35 defvar variables in library/loop.lisp follow
And Thomas A. Russ also writes:
> We would like to spare our users these messages.
> (defvar c 3)
> (compile nil
> '(lambda (a b c)
> (declare (ignore b c))
> (* a a)))
> ;Compiler warnings:
> ; Variable C not ignored, in an anonymous lambda form.
> I would like to be able to detect when a variable is proclaimed
> special and thus avoid this compiler warning.
To eliminate the warnings without checking for
special variables, then declare the variables to be ignorable:
(defvar c 3)
'(lambda (a b c)
(declare (ignorable b c))
(* a a)))