[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"bound but never used" is brain damaged



CC: (BUG LISPM) at MIT-AI

    MLB@MIT-AI 09/26/79 12:18:54 Re: "bound but never used" is brain damaged
    The compiler is brain damaged about "bound but never used":
    (DEFUN SCREW (&AUX (FOO 69.)) (EVAL (READ)))
    (screw) foo --> 105
    (compile 'screw) --> Warning: FOO is bound but never used.
    (screw) foo --> Barf, FOO is unbound, the sky is falling, etc.

Was FOO declared special? If not then there is no reason to expect
it to be bound during the EVAL even if it had been used elsewhere in the 
function:
(defun not-a-screw-at-all (&aux (foo 69.)) (print foo) (eval (read)))
(not-a-screw-at-all)
105 foo --> 105
(compile 'not-a-screw-at-all) --> No complaints.
(not-a-screw-at-all)
105 foo --> Barf, FOO is unbound, your socks are falling, etc.

Declaring FOO special is the way to make things like this work.

    ...

    I have also observed it to mistakenly decide a variable isn't used
    because it is inside a backquoted form, even though it actually IS
    used because of being commatose.

I would like to see an example of this!