This little piece of code

  (defun foo ()
    (declare (special x))
    (declare (type fixnum x))
    (1+ x))

will, when compiled, issue a warning
  
  Warning: This variable is undefined:
    X

in CMUCL (and also in SBCL and SCL). With higher optimization settings
CMUCL will also complain that it can't optimize the 1+ form so
obviously the type declaration really has no effect.

I could only get what I wanted with LOCALLY wrapped around the second
declaration like this:
  
  (defun foo ()
    (declare (special x))
    (locally
      (declare (type fixnum x))
      (1+ x)))

AllegroCL, LispWorks, and CLISP don't complain about the first
version. Is this a bug in Python or is it compliant behaviour while
the other implementations just give leeway?

Thanks,
Edi.

Reply via email to