Package: closer-mop

Generic Function compute-discriminating-function

Lambda List

compute-discriminating-function (gf)

Arguments

The generic-function argument is a generic function metaobject.

Return Value

The value returned by this generic function is a function.

Details

This generic function is called to determine the discriminating function for a generic function. When a generic function is called, the installed discriminating function is called with the full set of arguments received by the generic function, and must implement the behavior of calling the generic function: determining the ordered set of applicable methods, determining the effective method, and running the effective method.

To determine the ordered set of applicable methods, the discriminating function first calls compute-applicable-methods-using-classes. If compute-applicable-methods-using-classes returns a second value of false, the discriminating function then calls compute-applicable-methods.

When compute-applicable-methods-using-classes returns a second value of true, the discriminating function is permitted to memoize the first returned value as follows. The discriminating function may reuse the list of applicable methods without calling compute-applicable-methods-using-classes again provided that:
  1. the generic function is being called again with required arguments which are instances of the same classes,
  2. the generic function has not been reinitialized,
  3. no method has been added to or removed from the generic function,
  4. for all the specializers of all the generic function's methods which are classes, their class precedence lists have not changed and
  5. for any such memoized value, the class precedence list of the class of each of the required arguments has not changed.
Determination of the effective method is done by calling compute-effective-method. When the effective method is run, each method's function is called, and receives as arguments: (i) a list of the arguments to the generic function, and (ii) whatever other arguments are specified in the call-method form indicating that the method should be called. (See make-method-lambda for more information about how method functions are called.)

The generic function compute-discriminating-function is called, and its result installed, by add-method, remove-method, initialize-instance and reinitialize-instance.

Methods

compute-discriminating-function (generic-function standard-generic-function)
No behavior is specified for this method beyond that specified for the generic function.

This method can be overridden.