Next: , Previous: , Up: method* and define-method*   [Contents][Index]


8.6.5.2 Type dispatch and redefinition for advanced argument handling

As in CLOS, GOOPS only does type dispatch on required arguments, also for method*. For a method* with keyword formals, the list of specializers becomes the same as for a corresponding method with the same number of required arguments and a tail/rest argument. For example, the list of specializers for

(define-method* (foo (a <integer>) b #:optional c #:key d)
  ...)

becomes

(<integer> <top> . <top>)

This means that (method (a <integer>) b) ...) is more specialized than (method (a <integer>) b #:optional c #:key d) ...) and will come before the latter in the list of applicable methods.

Two methods of the same generic function can’t have the same specializers list. This means that if we do

(define-method* (foo (a <integer>) b #:optional c)
 ...)
(define-method* (foo (a <integer>) b . rest)
 ...)

the second define-method* will cause a redefinition such that the second method will replace the first.