이 코드는 경고 메시지를 제외하고는 원하는대로 작동합니다. GNU Common Lisp에서 다른 가능한 경고 메시지를 억제하지 않고 어떻게 메시지를 표시하지 않을 수 있습니까? Vatine의 종류 응답에 응답GNU clisp : 적용 할 수없는 메소드에 대한 경고 메시지를 표시하지 않음
1 (defgeneric zang (x y)
2 (:documentation "they want you to put documentation here"))
3 (defmethod zang ((a number) (b string))
4 (format t "got to zang ((~s number) (~s string))~%" a b))
5 (defmethod zang ((a integer) (b string))
6 (format t "got to zang ((~s integer) (~s string))~%" a b)
7 (when (evenp a)
8 (format t "passing control to the other guy~%")
9 (call-next-method (1+ a) "hoo boy")
10 (format t "returned control from the other guy~%")))
11 (defmethod no-applicable-method (zang &rest args)
12 (format t "no applicable method for (zang ~{~s~^ ~})~%" args))
13 (zang 3.5 "hi")
14 (zang 3 "hi")
15 (zang 4 "hi")
16 (zang "hello" "world")
WARNING: Replacing method #<STANDARD-METHOD (#<BUILT-IN-CLASS T>)> in
#<STANDARD-GENERIC-FUNCTION NO-APPLICABLE-METHOD>
got to zang ((3.5 number) ("hi" string))
got to zang ((3 integer) ("hi" string))
got to zang ((4 integer) ("hi" string))
passing control to the other guy
got to zang ((5 number) ("hoo boy" string))
returned control from the other guy
no applicable method for (zang "hello" "world")
편집는 :
나는 것을 시도하고, 상황은 치명적인 오류로 경고 에스컬레이션 : 내가 생각
(defgeneric zang (x y)
(:documentation "they want you to put documentation here"))
(defmethod zang ((a number) (b string))
(format t "got to zang ((~s number) (~s string))~%" a b))
(defmethod zang ((a integer) (b string))
(format t "got to zang ((~s integer) (~s string))~%" a b)
(when (evenp a)
(format t "passing control to the next guy~%")
(call-next-method (1+ a) "hoo boy")
(format t "returned control from the next guy~%")))
;(defmethod no-applicable-method (zang &rest args)
; (format t "no applicable method for (zang ~{~s~^ ~})~%" args))
(defmethod no-applicable-method ((zang eql #'zang) &rest args)
(format t "no applicable method for (zang ~{~s~^ ~})~%" args))
(zang 3.5 "hi")
(zang 3 "hi")
(zang 4 "hi")
(zang "hello" "world")
*** - DEFMETHOD NO-APPLICABLE-METHOD: Invalid specialized parameter in method
lambda list ((ZANG EQL #'ZANG) &REST ARGS): (ZANG EQL #'ZANG)
가 인쇄 "방법을 교체"경고를 억제 여부를 하시겠습니까? " 해당 방법 없음 "? –
"WARNING : Replacing method"로 시작하는 두 줄을 표시하지 않으려합니다. –