这个警告意味着什么?我有一个我在下面使用的例子,有这个警告。我在某处做错了吗?
(defvar B_00 0)
(defvar B_000 0)
(defvar w_000 0)
(defvar w_00 0)
(defconstant white 0)
(defclass board ()
((blocker :accessor blocker :initarg :blocker :initform 0)
(friends :accessor friends :initarg :friends :initform (make-array '(2)))
(kings :accessor kings :initarg :kings :initform (make-array '(2)))
(boards :accessor boards :initarg :boards :initform (make-array '(2 7) :initial-element 0))
(enpassant :accessor enpassant :initarg :enpassant :initform -1)
(color :accessor color :initarg :color :initform WHITE)
(castling :accessor castling :initarg :castling :initform (logior B_000 B_00 W_000 W_00))
(hasCastled :accessor hasCastled :initarg :hasCastled :initform (make-array '(2) :initial-element nil))
(fifty :accessor fifty :initarg :fifty :initform 0)
(checked :accessor checked :initarg :checked :initform nil)
(opchecked :accessor opchecked :initarg :opchecked :initform nil)
(arBoard :accessor arBoard :initarg :arBoard :initform (make-array '(64)))
(hash :accessor hash :initarg :hash :initform 0)
(pawnhash :accessor pawnhash :initarg :pawnhash :initform 0)
(history :accessor history :initarg :history :initform '())))
(defmethod ischecked ((b board)) b)
答案 0 :(得分:6)
在定义实现它的任何方法之前,您应该使用DEFGENERIC定义泛型函数。没有匹配的泛型函数定义的方法定义将自动创建一个泛型函数(即隐式)。但是,如果你自己定义一个泛型函数,即使你不需要defgeneric
特有的任何特性(尽管界面文档是个好主意),如果你在任何一个方法中拼错了名字,你会收到警告定义。它还清楚地表明,如果它们被改变并且在方法之间变得不匹配,那么它们应该是什么。