Lisp - allow variable to be used *or* unused?

117 Views Asked by At

If I (declare (ignore foo)) then lisp* won't warn me about unused variables, but will warn if I do use the variable. Is there a way I can turn off warnings either way?

Asking because I want to write some macros that introduce common/standard variable names in my application, but I don't want to have to always declare the unused ones where I use the macros, but I also don't want the warnings.

I'd rather not turn them off globally, and it'd be nice to avoid any logic that has to scan the forms fed into the macro, that seems like it would just complicate the logic.

* SBCL, if it makes any difference

1

There are 1 best solutions below

0
Rainer Joswig On BEST ANSWER

Use (declare (ignorable foo)).

See IGNORABLE in the Common Lisp HyperSpec.