[Openmcl-devel] Spurious compiler warning?

Bit Twiddler bitwiddler at gmail.com
Thu Dec 8 12:35:18 PST 2011


More or less extracted from Mcclim, if I try to compile the following:

(deftype coordinate () 'real)
(declaim (inline coordinate))
(defun coordinate (n) n)

;(defclass standard-translation (standard-transformation)
(defclass standard-translation ()
  ((dx :type coordinate :initarg :dx)
   (dy :type coordinate :initarg :dy)))

(defmethod transform-position ((transformation standard-translation) x y)
  (with-slots (dx dy) transformation
    (let ((x (coordinate x))
          (y (coordinate y)))
      (declare (type coordinate dx dy x y))
      (values (+ x dx) (+ y dy)))))

ccl 1.6 complains about the type declarations for dx and dy, and I get
the following:

;Compiler warnings for "home:p;cl;test;ccl;test-slot-type-decl.lisp.newest" :
;   In (TRANSFORM-POSITION (STANDARD-TRANSLATION T T)) inside an
anonymous lambda form: TYPE declaration for unknown variable DX
;   In (TRANSFORM-POSITION (STANDARD-TRANSLATION T T)) inside an
anonymous lambda form: TYPE declaration for unknown variable DY

Shouldn't this be kosher?



More information about the Openmcl-devel mailing list