[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Need for (declare (ignorable ...))
Suppose a rather smart compiler that knows if things are being evaluated
for effect or for value, and if functions are meant to be called for
effect or for value. It would be rather natural for such a compiler to
warn if you are using something for effect which has absolutely no side
effects. A reference to a variable, as in
(defun foo (x)
x
'bar)
could be considered 'an error in semantics' and the compiler might be
justified in producing a warning.
Likewise
(defun foo (x)
(cons x x)
'bar)
could be considered an error. Granted, it side effects the consing
system, the storage system, the paging system and the GC, but those are
supposed to be invisible to Lisp.
I'm not saying free references to variables should produce these
warnings. Because we don't currently have an IGNORABLE declaration, it
probably shouldn't. If and when we do, I personally would probably lean
toward encouraging compilers to issue warnings under these
circumstances.