On 20 March 2011 03:06, Zach Beane xach@xach.com wrote:
"Chun Tian (binghe)" binghe.lisp@gmail.com writes:
(defclass a-class () ((slot :type 'a-subclass)))
(defclass a-subclass (a-class) ())
When compiling the first class definition, SBCL warn that the type A-SUBCLASS haven't been defined
I can't reproduce. Is this an oversimplification of your actual problem?
Me neither, but...
(declaim (optimize safety))
(defclass a-class () ((slot :type 'a-subclass)))
(defclass a-subclass (a-class) ())
(defmethod foo ((x a-class) y) (setf (slot-value x 'slot) y))
gives:
; caught WARNING: ; Undefined type 'A-SUBCLASS. The name starts with QUOTE: probably use of a ; quoted type name in a context where the name is not evaluated.
Replace 'a-subclass with a-subclass, and modern (1.0.45.11 or later, I would guess) SBCL is silent and happy. (Though really SBCL _should_ complain about the quote even without the OPTIMIZE SAFETY and DEFMETHOD FOO...) :P
Cheers,
-- Nikodemus