From: Josef Eschgfaeller
Subject: Re: defvar
Date: 
Message-ID: <379EFDD7.2585B246@felix.unife.it>
Pierre Mai wrote:

>>> (declaim '(inline ignore-please))
>>> (defun ignore-please (&rest x)
>>>   (declare (ignore x)) nil)

> ignore-please above is a _function_, so that the (declare (ignore x))
> in it just states that the variable (or parameter) x itself is not
> used, and should therefore be ignored.  What x is bound to at call
> time doesn't matter at all.

> the normal ignoring part of ignore-please is done at call
> time, where the compiler will see a call to a function with a certain
> set of parameters, so it will assume that every parameter passed is
> therefore used, and will not warn about them.

I try to reconstruct it. If I write

  (defun sum-of-first-two (&rest x)
    (+ (first x) (second x)))

and call then (sum-of-first-two 1 2 3), then there happens something
like (let ((x (list 1 2 3))) ... ), and (first x) and (second x) are
defined.

Similarly if after

  (defun f (a p q) (ignore-please p q) a)

I call (f 5 0 1), Lisp does something like

  (let* ((a 5) (p 0) (q 1) (x (list p q))) (declare (ignore x)) a)

and all this works because in this artificial way the parameters
p and q "are used", which

> really only ensures that the compiler doesn't warn

as you write, meaning, if I understand well, that the only important
thing in the last (declare (ignore x)) is that nothing happens, not
even an evaluation of x. Is this interpretation acceptable?

je