Hi,
In the CLHS page for ENSURE-GENERIC-FUNCTION, there is this paragraph:
"If function-name specifies a generic function that has a different
value for the :generic-function-class argument and if the new generic
function class is compatible[1] with the old, change-class is called to
change the class of the generic function; otherwise an error is
signaled."
In the AMOP however, one can read the following.
>From the page on ENSURE-GENERIC-FUNCTION:
"The behavior of this function is actually implemented by the generic
function ensure-generic-function-using-class. When
ensure-generic-function is called, it immediately calls
ensure-generic-function-using-class and returns that result as its own."
And then from the page on ENSURE-GENERIC-FUNCTION-USING-CLASS:
"If the class of the generic-function-or-nil argument is not the same as
the class specified by the :generic-function-class argument, an error is
signaled."
Let alone the fact that this should only apply when there actually is an
existing generic function, this seems to be in contradiction with the
Common Lisp standard, as it would explicitly forbid changing the class
of the generic function, even in a "compatible" way.
Comments?
Footnotes:
[1] BTW, what does "compatible" mean ?
--
Resistance is futile. You will be jazzimilated.
Lisp, Jazz, Aïkido: http://www.didierverna.info
Hello,
there is something annoying with
ensure-generic-function-using-class. The MOP specifies that if the
:generic-function-class option is not provided, it defaults to
standard-generic-function. While this makes perfect sense when the
generic function doesn't already exist, it seems to also apply when it
does.
As a result, if you want to call ensure-generic-function on an existing
generic function using a different meta-class, for instance like this:
(ensure-generic-function gf-name :generic-function-class (class-of gf))
This is a bit annoying, and I don't understand the rationale behind
this, if there's one. Why not defaulting to the existing generic
function's meta-class?
--
Resistance is futile. You will be jazzimilated.
Lisp, Jazz, Aïkido: http://www.didierverna.info