CLHS: Local Function CALL-NEXT-METHOD

#

Local Function CALL-NEXT-METHOD

Syntax:

call-next-method `&rest` args => result*

Arguments and Values:

arg---an object.

results---the values returned by the method it calls.

Description:

The function call-next-method can be used within the body forms (but not the lambda list) of a method defined by a method-defining form to call the next method.

If there is no next method, the generic function no-next-method is called.

The type of method combination used determines which methods can invoke call-next-method. The standard method combination type allows call-next-method to be used within primary methods and around methods. For generic functions using a type of method combination defined by the short form of define-method-combination, call-next-method can be used in around methods only.

When call-next-method is called with no arguments, it passes the current method's original arguments to the next method. Neither argument defaulting, nor using setq, nor rebinding variables with the same names as parameters of the method affects the values call-next-method passes to the method it calls.

When call-next-method is called with arguments, the next method is called with those arguments.

If call-next-method is called with arguments but omits optional arguments, the next method called defaults those arguments.

The function call-next-method returns any values that are returned by the next method.

The function call-next-method has lexical scope and indefinite extent and can only be used within the body of a method defined by a method-defining form.

Whether or not call-next-method is fbound in the global environment is implementation-dependent; however, the restrictions on redefinition and shadowing of call-next-method are the same as for symbols in the `COMMON-LISP` package which are fbound in the global environment. The consequences of attempting to use call-next-method outside of a method-defining form are undefined.

Examples: None.

Affected By:

defmethod, call-method, define-method-combination.

Exceptional Situations:

When providing arguments to call-next-method, the following rule must be satisfied or an error of type error should be signaled: the ordered set of applicable methods for a changed set of arguments for call-next-method must be the same as the ordered set of applicable methods for the original arguments to the generic function. Optimizations of the error checking are possible, but they must not change the semantics of call-next-method.

See Also:

define-method-combination, defmethod, next-method-p, no-next-method, call-method, Section 7.6.6 (Method Selection and Combination), Section 7.6.6.2 (Standard Method Combination), Section 7.6.6.4 (Built-in Method Combination Types)

Notes: None.

The following X3J13 cleanup issues, not part of the specification, apply to this section:

- LEXICAL-CONSTRUCT-GLOBAL-DEFINITION:UNDEFINED
- METHOD-INITFORM:FORBID-CALL-NEXT-METHOD

Copyright 1996-2005, LispWorks Ltd. All rights reserved.