Next: , Up: Discriminating Functions


3.1 The Initial Discriminating Function

The system method on SB-MOP:COMPUTE-DISCRIMINATING-FUNCTION, under most circumstances, returns a function which closes over a structure of type SB-PCL::INITIAL, and which calls SB-PCL::INITIAL-DFUN. This discriminating function is responsible for implementing the computation of the applicable methods, the effective method, and thence the result of the call to the generic function. In addition, it implements optimization of these steps, based on the arguments it has been called with since the discriminating function was installed and the methods of the generic function.

discriminating-functions.png

Figure 3.1

For each substantive change of the generic function (such as addition or removal of a method, or other reinitialization) the discriminating function is reset to its initial state.

The initial discriminating function can transition into a discriminating function optimized for the methods on the generic function (SB-PCL::NO-METHODS, SB-PCL::DEFAULT-METHOD-ONLY, SB-PCL::CONSTANT-VALUE), for slot access (SB-PCL::ONE-CLASS, SB-PCL::TWO-CLASS, SB-PCL::ONE-INDEX, SB-PCL::N-N1), or for dispatch based on its arguments (SB-PCL::CACHING, SB-PCL::DISPATCH). Those in the second category can transition into the third, or into a SB-PCL::CHECKING state where the choice between SB-PCL::CACHING and SB-PCL::DISPATCH has not yet been made.

The possible transitions are shown in Figure 3.1.


Footnotes

[1] Would be better named as M-N, as there is no requirement for the number of classes and number of indices to be the same.