Next: , Previous: , Up: Methods   [Contents][Index]


5.1 Method Datatype

The following procedures are used to construct and inspect methods.

Procedure: make-method specializers procedure

Creates and returns a new method. Note that specializers may have fewer elements than the number of required parameters in procedure; the trailing parameters are considered to be specialized by <object>.

After the returned method is stored in a generic procedure, Procedure is called by the effective method procedure of the generic procedure when the generic procedure is called with arguments satisfying specializers. In simple cases, when no method combination occurs, procedure is the effective method procedure.

Procedure: method? object

Returns #t iff object is a method, otherwise returns #f.

Generic Procedure: method-specializers method

Returns the specializers of method. This list must not be modified.

Generic Procedure: method-procedure method

Returns the procedure of method.

Procedure: method-applicable? method classes

This predicate is used to determine the applicability of method. When a method is contained in a generic procedure, and the procedure is applied to some arguments, the method is applicable if each argument is an instance of the corresponding method specializer, or equivalently, if each argument’s class is a subclass of the corresponding method specializer.

method-applicable? determines whether method would be applicable if the given arguments had the classes specified by classes. It returns #t if each element of classes is a subclass of the corresponding specializer of method, and #f otherwise.


Next: Method Syntax, Previous: Methods, Up: Methods   [Contents][Index]