www.delorie.com/gnu/docs/guile/goops_72.html   search  
 
Buy GNU books!


Goops Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.5.2 Next-method

When a generic function is called, the list of applicable methods is built. As mentioned before, the most specific method of this list is applied (see 5.5.1 Generic functions and methods). This method may call the next method in the list of applicable methods. This is done by using the special form next-method. Consider the following definitions

 
(define-method (Test (a <integer>)) (cons 'integer (next-method)))
(define-method (Test (a <number>))  (cons 'number  (next-method)))
(define-method (Test a)             (list 'top))

With those definitions,

 
(Test 1)   => (integer number top)
(Test 1.0) => (number top)
(Test #t)  => (top)


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003