Package: closer-mop

## Generic Function compute-applicable-methods-using-classes

### Lambda List

compute-applicable-methods-using-classes (

**generic-function****classes**)### Arguments

The generic-function argument is a generic function metaobject.

The classes argument is a list of class metaobjects.

The classes argument is a list of class metaobjects.

### Return Value

This generic function returns two values. The first is a possibly empty list of method metaobjects. The second is either true or false.

### Details

This generic function is called to attempt to determine the method
applicability of a generic function given only the classes of the required
arguments.

If it is possible to completely determine the ordered list of applicable methods based only on the supplied classes, this generic function returns that list as its first value and true as its second value. The returned list of method metaobjects is sorted by precedence order, the most specific method coming first. If no methods are applicable to arguments with the specified classes, the empty list and true are returned.

If it is not possible to completely determine the ordered list of applicable methods based only on the supplied classes, this generic function returns an unspecified first value and false as its second value.

When a generic function is invoked, the discriminating function must determine the ordered list of methods applicable to the arguments. Depending on the generic function and the arguments, this is done in one of three ways: using a memoized value; calling compute-applicable-methods-using-classes; or calling compute-applicable-methods. (Refer to the description of compute-discriminating-function for the details of this process.)

The following consistency relationship between compute-applicable-methods-using-classes and compute-applicable-methods must be maintained: for any given generic function and set of arguments, if compute-applicable-methods-using-classes returns a second value of true, the first value must be equal to the value that would be returned by a corresponding call to compute-applicable-methods. The results are undefined if a portable method on either of these generic functions causes this consistency to be violated.

The list returned by this generic function will not be mutated by the implementation. The results are undefined if a portable program mutates the list returned by this generic function.

If it is possible to completely determine the ordered list of applicable methods based only on the supplied classes, this generic function returns that list as its first value and true as its second value. The returned list of method metaobjects is sorted by precedence order, the most specific method coming first. If no methods are applicable to arguments with the specified classes, the empty list and true are returned.

If it is not possible to completely determine the ordered list of applicable methods based only on the supplied classes, this generic function returns an unspecified first value and false as its second value.

When a generic function is invoked, the discriminating function must determine the ordered list of methods applicable to the arguments. Depending on the generic function and the arguments, this is done in one of three ways: using a memoized value; calling compute-applicable-methods-using-classes; or calling compute-applicable-methods. (Refer to the description of compute-discriminating-function for the details of this process.)

The following consistency relationship between compute-applicable-methods-using-classes and compute-applicable-methods must be maintained: for any given generic function and set of arguments, if compute-applicable-methods-using-classes returns a second value of true, the first value must be equal to the value that would be returned by a corresponding call to compute-applicable-methods. The results are undefined if a portable method on either of these generic functions causes this consistency to be violated.

The list returned by this generic function will not be mutated by the implementation. The results are undefined if a portable program mutates the list returned by this generic function.

### Methods

compute-applicable-methods-using-classes ((generic-function standard-generic-function) classes)

If any method of the generic function has a specializer which is neither a class metaobject nor an eql specializer metaobject, this method
signals an error.

In cases where the generic function has no methods with eql specializers, or has no methods with eql specializers that could be applicable to arguments of the supplied classes, this method returns the ordered list of applicable methods as its first value and true as its second value.

Otherwise this method returns an unspecified first value and false as its second value.

This method can be overridden. Because of the consistency requirements between this generic function and compute-applicable-methods, doing so may require also overriding compute-applicable-methods (standard-generic-function t).

In cases where the generic function has no methods with eql specializers, or has no methods with eql specializers that could be applicable to arguments of the supplied classes, this method returns the ordered list of applicable methods as its first value and true as its second value.

Otherwise this method returns an unspecified first value and false as its second value.

This method can be overridden. Because of the consistency requirements between this generic function and compute-applicable-methods, doing so may require also overriding compute-applicable-methods (standard-generic-function t).

### Notes

This generic function exists to allow user extensions which alter method
lookup rules, but which base the new rules only on the classes of the
required arguments, to take advantage of the class-based method lookup
memoization found in many implementations. (There is of course no
requirement for an implementation to provide this optimization.)

Such an extension can be implemented by two methods, one on this generic function and one on compute-applicable-methods. Whenever the user extension is in effect, the first method will return a second value of true. This should allow the implementation to absorb these cases into its own memoization scheme.

To get appropriate performance, other kinds of extensions may require methods on compute-discriminating-function which implement their own memoization scheme.

Such an extension can be implemented by two methods, one on this generic function and one on compute-applicable-methods. Whenever the user extension is in effect, the first method will return a second value of true. This should allow the implementation to absorb these cases into its own memoization scheme.

To get appropriate performance, other kinds of extensions may require methods on compute-discriminating-function which implement their own memoization scheme.