[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question about ignoring IGNORE

    Date: Thu, 19 Nov 87 18:24 EST
    From: Beng-Hong Lim <BHLim@JASPER.Palladian.COM>

	Date: Wed, 18 Nov 87 11:17 EST
	From: Jeffrey Mark Siskind <Qobi@ZERMATT.LCS.MIT.EDU>

	If I have a macro which expands into some lisp code which contains
	local variable definitions (either through LET or DEFUN etc.)
	and I don't know or care whether all such variables will be used
	by any particular expansion of the macro, I run into the
	following annoying problem. The compiler will complain and issue
	warnings that the variables are unused, but if I declare them
	as (DECLARE (IGNORE FOO)) and the variables are unused then
	the compiler will complain and issue a warning that the variables
	are used. It turns out to be to much of a pain for me to
	determine whether a given variable is used and conditionally
	include its binding in the expanded output of the macro. So
	as the old saying goes, how do I avoid being "Damned if you
	do, and damned if you don't"? What I really want is something

    You can't use a declaration in this case if you want to avoid the
    warnings.  Best you can do is "use" the variables e.g.  by saying
    (PROGN A B C) where A, B, and C are the local variables that may or
    may not be used.  You then hope that the compiler is smart enough to
    ignore the PROGN. (On the Symbolics it is.)  Or if you want something
    more semantically pleasing than PROGN, then use (IGNORE A B C) on
    Symbolics which macroexpands to (PROGN A B C). 


Well, no.  Actually IGNORE is implemented something that looks a lot
like this:


Ignoring the declares, it just returns NIL as a subst.  Note that since
IGNORE works differently on the Symbolics than in Common Lisp, you would
have to do something like this for CL compatability: