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

conflicting declarations



I could not find anything in Chapter 9 to cover the case of multiple
declarations for the same variable binding, particularly the case of
conflicting declarations.  Examples:

1. (defun foo (x)
     (declare (type float x))
     (declare (type float x)) ; redundant
     ...

2. (defun foo (x)
     (declare (type float x))
     (declare (type integer x)) ; conflicting
     ...

3. (defun foo (x)
     (declare (type number x))
     (declare (type integer x)) ; restricting
     ...

4. (defun foo (x)
     (declare (type integer x))
     (declare (type number x)) ; enlarging
     ...

Any opinions on what the definition does or should say in such cases?
Should any set of individually legal declarations be legal, with the
textually last declaration taking effect in cases of conflict?  Should
an error be signalled if multiple declarations of the same "kind" are
found?  If so, in all cases above?

(I find example 3 remotely reasonable.  Perhaps the first declaration is
machine-generated and the second was added by the programmer who knew
more?)

-------