Oop Can';当第一个参数为nil时,是否调用方法?
我得到一个:Oop Can';当第一个参数为nil时,是否调用方法?,oop,lisp,common-lisp,clos,Oop,Lisp,Common Lisp,Clos,我得到一个: (carpet-append nil #s(image-rectangle :position (0 . 0) :size (48 . 76) :file "/home/wvxvw/projects/spritesheet/test-images/test-0.png")) #如果您有一个arglist,其中包含类地毯和图像矩形,参数最好是这些类或它们的子类。当您的参数被声明为类地毯时,您不能通过NIL 因此(如果此没有意义。如果您通过地毯对象,而您不
(carpet-append
nil
#s(image-rectangle
:position (0 . 0)
:size (48 . 76)
:file "/home/wvxvw/projects/spritesheet/test-images/test-0.png"))
#如果您有一个arglist,其中包含类地毯
和图像矩形
,参数最好是这些类或它们的子类。当您的参数被声明为类地毯时,您不能通过NIL
因此(如果此没有意义。如果您通过地毯对象,而您不能通过任何其他测试,则测试此将始终为真
如果要为NIL
对象和矩形编写方法,则可以使用该类
因为CLOS没有像OR和那样的类组合符,所以必须为每种情况编写一个方法
(carpet-append
nil
#s(image-rectangle
:position (0 . 0)
:size (48 . 76)
:file "/home/wvxvw/projects/spritesheet/test-images/test-0.png"))
#<SIMPLE-ERROR "~@<There is no applicable method for the generic function ~2I~_~S~
~I~_when called with arguments ~2I~_~S.~:>"
(defmethod carpet-append ((this null) (rect image-rectangle))
...)