next up previous

12.15.6 Calling Shadowed Methods

If the conditions are such that the function next-methodp would return the symbol TRUE (see section 12.15.5), then calling the function call-next-method will execute the shadowed (see section 8.5.3) method. Otherwise, a method execution error will occur (see section 8.5.4). In the event of an error, the return value of this function is the symbol FALSE, otherwise it is the return value of the shadowed method. The shadowed method is passed the same arguments as the calling method.

A method may continue execution after calling call-next-method. In addition, a method may make multiple calls to call-next-method, and the same shadowed method will be executed each time.

Syntax

(call-next-method)

Example

CLIPS>
(defmethod describe ((?a INTEGER))
  (if (next-methodp) then
     (bind ?extension (str-cat " " (call-next-method)))
   else
     (bind ?extension ""))
  (str-cat "INTEGER" ?extension))
CLIPS> (describe 3)
"INTEGER"
CLIPS>
(defmethod describe ((?a NUMBER))
  "NUMBER")
CLIPS> (describe 3)
"INTEGER NUMBER"
CLIPS> (describe 3.0)
"NUMBER"
CLIPS>


next up previous