[CLOS] Ensuring a method exists




Hi !

Suppose I have:

(defgeneric foo (a b) ...)

(defclass base () ...)
(defmethod foo ((a base) (b base)) ...)



I'd like to ensure that if somebody writes a derived class:

(defclass derived (base) ...)

she also provides a method for this class:

(defmethod foo ((a derived) (b derived)) ...)



I'd be happy with a dynamic solution. Perhaps, the method combination would
check that the first applicable method matches exactly the class of the
arguments. But I know nothing about the MOP yet ...


Thanks !

--
Check out my new jazz CD on http://www.didierverna.com/ !

Didier Verna EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bicêtre, France Fax.+33 (1) 53 14 59 22
.



Relevant Pages

  • Re: [CLOS] Ensuring a method exists
    ... (defgeneric foo (a b) ... (defclass base () ... I'd like to ensure that if somebody writes a derived class: ... to define the foo method? ...
    (comp.lang.lisp)
  • Re: [CLOS] Ensuring a method exists
    ... (defgeneric foo (a b) ... (defclass base () ... I'd like to ensure that if somebody writes a derived class: ... to define the foo method? ...
    (comp.lang.lisp)
  • Re: [CLOS] Ensuring a method exists
    ... (defgeneric foo (a b) ... (defclass base () ... I'd like to ensure that if somebody writes a derived class: ... to define the foo method? ...
    (comp.lang.lisp)