(reported by Bruno Haible)
ANSI CL is silent on this, but the MOP's specification of ENSURE-GENERIC-FUNCTION says:
"The remaining arguments are the complete set of keyword arguments
received by ENSURE-GENERIC-FUNCTION."
and the spec of ENSURE-GENERIC-FUNCTION-USING-CLASS:
":GENERIC-FUNCTION-CLASS - a class metaobject or a class name. If it is not
supplied, it defaults to the class named STANDARD-GENERIC-FUNCTION."
This is not the case in SBCL. Test case:
(defclass my-generic-function (standard-generic-function)
()
(:metaclass sb-pcl:funcallable-standard-class))
(setf (fdefinition 'foo1) (make-instance 'my-generic-function :name 'foo1))
(ensure-generic-function 'foo1
:generic-function-class (find-class 'standard-generic-function))
(class-of #'foo1)
; => #<SB-MOP:FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION>
(setf (fdefinition 'foo2) (make-instance 'my-generic-function :name 'foo2))
(ensure-generic-function 'foo2)
(class-of #'foo2)
Expected: #<SB-MOP:FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION>
Got: #<SB-MOP:FUNCALLABLE-STANDARD-CLASS MY-GENERIC-FUNCTION>
(reported by Bruno Haible) GENERIC- FUNCTION says: GENERIC- FUNCTION. " GENERIC- FUNCTION- USING-CLASS: FUNCTION- CLASS - a class metaobject or a class name. If it is not GENERIC- FUNCTION. " generic- function) funcallable- standard- class))
(make- instance 'my-generic- function :name 'foo1)) generic- function 'foo1 function- class (find-class 'standard- generic- function) ) FUNCALLABLE- STANDARD- CLASS STANDARD- GENERIC- FUNCTION>
(make- instance 'my-generic- function :name 'foo2)) generic- function 'foo2) FUNCALLABLE- STANDARD- CLASS STANDARD- GENERIC- FUNCTION> FUNCALLABLE- STANDARD- CLASS MY-GENERIC- FUNCTION>
ANSI CL is silent on this, but the MOP's specification of ENSURE-
"The remaining arguments are the complete set of keyword arguments
received by ENSURE-
and the spec of ENSURE-
":GENERIC-
supplied, it defaults to the class named STANDARD-
This is not the case in SBCL. Test case:
(defclass my-generic-function (standard-
()
(:metaclass sb-pcl:
(setf (fdefinition 'foo1)
(ensure-
:generic-
(class-of #'foo1)
; => #<SB-MOP:
(setf (fdefinition 'foo2)
(ensure-
(class-of #'foo2)
Expected: #<SB-MOP:
Got: #<SB-MOP: