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

type declarations of special bindings

re: In the following example, does the fixnum declaration apply to the
    inner reference to X (in the setq)?
      (let ((X 17))
	(declare (special X) (fixnum X))
	(let ((X 'local))
	    (declare (special X))
	    (setq X (foo)))))

CLtL, p 158 says that type declarations affect the binding "and specifies
that the variable[s] mentioned will take on values only of the specified
type".  The inner reference is to the variable bound specially, not to
the one bound locally, so it is the same variable whose binding was
declared fixnum.  Hence, in theory, it should be as if the form
	(setq X (foo))
were written as
	(setq X (the fixnum (foo)))
but I suspect very few, if any, compilers actually make this leap of type 

-- JonL --