Feature Request: Style warning on 'suspicious' constant/symbol
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Opinion
|
Undecided
|
Unassigned |
Bug Description
A user error I see come up here and there, especially among beginners, is something along the lines of:
(defun foo (&key a b c)
(list c a b))
(let ((bar 0) (baz 1) (quux 2))
(foo :a bar)
:b baz
:c quux)
Where clearly parens lining up was incorrect.
This occurs in any other places with progn-style behaviour, except notably, tagbody.
This class of bug would be eliminated if SBCL were to notice usage of a constant (here :b and :c) or a symbol (here baz) being in a position where their value is completely unused as in the above, and signal a style warning along the lines of
style-warning:
Suspicious use of constant :B in noop position
I'm struggling to come up with a better name than 'noop' or 'unimpactful', but the general idea should be clear.
Additionally, in reference to tagbody, it would be useful to signal a style-warning on referenced tags, which would accomplish the equivalent 'fix' for the user-error in those cases.
Clearly this is low priority, but I believe it'd be very useful and I imagine it's relatively low effort to implement.
For posterity, this is as of SBCL 1.5.4
One would have to be sure that macros only very rarely expand to such code.