Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oop Can';当第一个参数为nil时,是否调用方法?_Oop_Lisp_Common Lisp_Clos - Fatal编程技术网

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))
   ...)