On Sat, Jan 12, 2008 at 11:13 PM, Tobias C. Rittweiler <tcr@...> wrote:
> The CLHS entry for IGNORE says
> The stream variables established by with-open-file, with-open-stream,
> with-input-from-string, and with-output-to-string, and all /iteration
> variables/ are, by definition, always ``used''. Using (declare (ignore
> v)), for such a variable v has unspecified consequences.
> And an /iteration variable/ is a binding established by one of
> do do-external-symbols dotimes
> do* do-symbols loop
> do-all-symbols dolist
> It _must not_ return a list where any sublist is of the form (FOO T) as
> this would mean that style-warning was signalled without a IGNORE
> declaration, which is against the above quote from CLHS.
The attached patch takes care of this in SBCL, but I don't think I
want to commit this as I don't believe this is really a bug.
There are certain cases where we are *required* to signal a
style-warning, but as far as I can tell a compiler is always *allowed*
to signal one.
(lambda (lst) ...) -> "STYLE-WARNING: Ugly code, name your variables properly!"
Would be legal, even if annoying. Hence,
(dotimes (i 100) (foo)) -> "STYLE-WARNING: The variable I is defined
but never used."
should also be legal. ...and in most cases not using an iteration
variable is an indication of a bug in user code, and hence a good
place for a style-warning.
(Currently DOLIST, and DO-FOO-SYMBOLS are affected by this in SBCL.)