[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
IGNORABLE
Date: Fri, 7 Mar 86 13:05:09 EST
From: Jonathan A Rees <JAR@MC.LCS.MIT.EDU>
Common Lisp (and in fact, every language that has variables) needs a
(DECLARE (IGNORABLE ...)) in addition to (DECLARE (IGNORE ...)). The
meaning of (DECLARE (IGNORABLE X)) is: the variable X might or might not
be used, and I don't want the compiler to generate a warning in either
case.
There is no way to simulate this feature in Common Lisp. ...
While I agree that (DECLARE (IGNORABLE ...)) would be nice.
I dispute your contention that you can't simulate this feature. I always just write:
(DEFMACRO WITH-FOO (&BODY BODY)
`(LET ((FOO (COMPUTE-FOO)))
FOO ;ignorable
,@(OR BODY '(NIL))))
I've never seen a reasonable Lisp compiler that didn't handle this correctly.
I would even argue that it is indirectly implied by the language specification
that this must work, and that it's a bug if a compiler warns either about
no FOO in body or a FOO in body.
-kmp
ps Please no discussion about what happens if BODY begins with a DECLARE form.
The example above is obviously oversimplified in that respect, but adequate
discussion of that issue has already taken place and isn't relevant here.