Lisp HUG Maillist Archive

Subclassing standard-generic-function

Hi,

I was hoping to use the MOP to define my own class of generic functions
and then specialize some generic functions like compute-applicable-methods,
compute-effective-method and make-method-lambda. But I can't even get
started, because it seems that Lispworks doesn't allow me to create
subclasses of standard-generic-function.

When I try something like

  (defclass my-generic-function (standard-generic-function)
     ())

I get the following error message:

  Error: #<FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION 20305E14> is 
  an invalid superclass of #<STANDARD-CLASS MY-GENERIC-FUNCTION 205E9DB4>.

Is there some other way to tweak the generic function and method calling
protocol?

Thanks,

Arthur Lemmens


Re: Subclassing standard-generic-function

> I was hoping to use the MOP to define my own class of generic functions
> and then specialize some generic functions like
compute-applicable-methods,
> compute-effective-method and make-method-lambda. But I can't even get
> started, because it seems that Lispworks doesn't allow me to create
> subclasses of standard-generic-function.
>
> When I try something like
>
>   (defclass my-generic-function (standard-generic-function)
>      ())
>
> I get the following error message:
>
>   Error: #<FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION 20305E14>
is
>   an invalid superclass of #<STANDARD-CLASS MY-GENERIC-FUNCTION 205E9DB4>.
>
> Is there some other way to tweak the generic function and method calling
> protocol?

You have to use the same metaclass for your class and the parent class. A
subclass of this metaclass should work also.

Marc


Re: Subclassing standard-generic-function

Unable to parse email body. Email id is 704

Updated at: 2020-12-10 09:01 UTC