[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Ignored Variables
- To: (BUG LISP) at MIT-AI, (BUG LISPM) at MIT-AI
- Subject: Ignored Variables
- From: GLS at MIT-AI (Guy L. Steele, Jr.)
- Date: Tue ,12 Aug 80 12:18:00 EDT
Presumably the only reason for explicitly mentioning that
a variable is ignored is for error-checking, so that the compiler
will not print the warning message if you're sure that the
variable is supposed to be ignored. Why not extend this
error-checking to the interpreter?
The use of () (or IGNORE, for that matter, though IGNORE is
mroe readable in my opinion) as a LAMBDA-variable I find
unacceptable as a general mechanism, because it doesn't let me
assign my own name to the ignored thing. Often ignored variables
arise in a situation where a function is called by some dispatching
mechanism (e.g., fetching from a property list), and so I want all
the LAMBDA-lists of the possible functions to look the same, because
they are conventionally passed a standard set of arguments which
have a standard set of names, but not all the dispatch possbilities
use all the arguments. (As an example of this, consider the command-
handlers for FORMAT.) I want to retain the names as standard, and separately
note that some are ignored.
On the other hand, just mentioning ignored variables at the front
of the function body is also unacceptable. I want a way to say EXPLICITLY
thast a variable is ignored, and get a warning message from the compiler
if the variable is in fact used! Also, if I depend on the front-of-
lambda-body technique to suppress unused-variable warnings, then I invite
"unused value" warnings (which the compiler ought also to generate
for situations such as (PROGN FOO (SETQ X Y)) and (PROGN (CONS A B) ...)).
I think there is much to be sadi for some kind of explicit declaration
of ignoring. IOt allows better error-checking in the compiler, makes
more clear what is going on, and even allows for error-checking
in the interpreter, which could recognize the declarations (either
(DECLARE (IGNORE ...)) or &IGNORE or whatever) and bind the variable
in question to the unbound value.