New SBCL warnings about set-but-not-read variables
Thanks to @pmarek for the heads-up.
SBCL 2.0.9 introduced warnings about variables which are assigned but never read and about variables which are assigned but ignored. This currently means that e.g.
(iterate (for a in '(1 2 3)))
produces a A is assigned but never read
style warning, whereas
(iterate (for a in '(1 2 3)) (declare (ignore a)))
produces a A is being set even though it was declared to be ignored
style warning.
A possible solution would be to declare all variables bound by Iterate as ignorable, which is what SBCL's LOOP internally does:
CL-USER> (macroexpand-1 '(loop for (a b c) in '()))
(BLOCK NIL
(LET ((A NIL) (B NIL) (C NIL) (#:LOOP-LIST-519 'NIL))
(DECLARE (IGNORABLE #:LOOP-LIST-519)
(IGNORABLE C)
(IGNORABLE B)
(IGNORABLE A))
(TAGBODY
(GO SB-LOOP::END-LOOP)
SB-LOOP::NEXT-LOOP
(SB-LOOP::LOOP-DESETQ (A B C) (CAR #:LOOP-LIST-519))
(SB-LOOP::LOOP-DESETQ #:LOOP-LIST-519 (CDR #:LOOP-LIST-519))
(WHEN (ENDP #:LOOP-LIST-519) (GO SB-LOOP::END-LOOP))
(GO SB-LOOP::NEXT-LOOP)
SB-LOOP::END-LOOP)))
T