From: Bruno Haible <bruno@cl...> - 2004-11-09 12:25:30
When ENSURE-GENERIC-FUNCTION is called without a :GENERIC-FUNCTION-CLASS
argument, the required effect, according to the MOP, is that:
1) ENSURE-GENERIC-FUNCTION calls ENSURE-GENERIC-FUNCTION-USING-CLASS
without a :GENERIC-FUNCTION-CLASS argument,
2) ENSURE-GENERIC-FUNCTION-USING-CLASS uses the class
STANDARD-GENERIC-FUNCTION as generic-function-class.
3) ENSURE-GENERIC-FUNCTION-USING-CLASS signals an error if the
generic function is already defined and belongs to a different class.
ANSI CL says that in step 3, the implementation can also use CHANGE-CLASS
to mutate the generic function instance.
Here is a test case:
(defclass my-generic-function (standard-generic-function)
(defgeneric testgf (x) (:generic-function-class my-generic-function))
(class-name (class-of #'testgf)))
Expected: ERROR or STANDARD-GENERIC-FUNCTION
By not signalling an error, SBCL behaves as if the default value of the
:GENERIC-FUNCTION-CLASS argument would depend on the already existing
function, which contradicts the statement
"The :generic-function-class argument is a class metaobject or a class
name. If it is not supplied. it defaults to the class named
Get latest updates about Open Source Projects, Conferences and News.