87 lines
4.3 KiB
HTML
87 lines
4.3 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>The Initial Discriminating Function - SBCL Internals</title>
|
|
<meta http-equiv="Content-Type" content="text/html">
|
|
<meta name="description" content="SBCL Internals">
|
|
<meta name="generator" content="makeinfo 4.11">
|
|
<link title="Top" rel="start" href="index.html#Top">
|
|
<link rel="up" href="Discriminating-Functions.html#Discriminating-Functions" title="Discriminating Functions">
|
|
<link rel="next" href="Method_002dBased-Discriminating-Functions.html#Method_002dBased-Discriminating-Functions" title="Method-Based Discriminating Functions">
|
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
|
<!--
|
|
|
|
This manual is part of the SBCL software system. See the `README'
|
|
file for more information.
|
|
|
|
This manual is in the public domain and is provided with
|
|
absolutely no warranty. See the `COPYING' and `CREDITS' files for
|
|
more information.
|
|
-->
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
<style type="text/css"><!--
|
|
pre.display { font-family:inherit }
|
|
pre.format { font-family:inherit }
|
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
|
pre.smallexample { font-size:smaller }
|
|
pre.smalllisp { font-size:smaller }
|
|
span.sc { font-variant:small-caps }
|
|
span.roman { font-family:serif; font-weight:normal; }
|
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
<div class="node">
|
|
<p>
|
|
<a name="The-Initial-Discriminating-Function"></a>
|
|
Next: <a rel="next" accesskey="n" href="Method_002dBased-Discriminating-Functions.html#Method_002dBased-Discriminating-Functions">Method-Based Discriminating Functions</a>,
|
|
Up: <a rel="up" accesskey="u" href="Discriminating-Functions.html#Discriminating-Functions">Discriminating Functions</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<!-- node-name, next, previous, up -->
|
|
<h3 class="section">3.1 The Initial Discriminating Function</h3>
|
|
|
|
<p><a name="index-compute_002ddiscriminating_002dfunction-1"></a><a name="index-sb_002dmop_003acompute_002ddiscriminating_002dfunction-2"></a>
|
|
The system method on <code>SB-MOP:COMPUTE-DISCRIMINATING-FUNCTION</code>,
|
|
under most circumstances, returns a function which closes over a
|
|
structure of type <code>SB-PCL::INITIAL</code>, and which calls
|
|
<code>SB-PCL::INITIAL-DFUN</code>. 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.
|
|
|
|
<div class="float">
|
|
<a name="fig_003adfun_002dtransitions"></a><img src="discriminating-functions.png" alt="discriminating-functions.png">
|
|
<p><strong class="float-caption">Figure 3.1</strong></p></div>
|
|
|
|
<p>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.
|
|
|
|
<p>The initial discriminating function can transition into a discriminating
|
|
function optimized for the methods on the generic function
|
|
(<code>SB-PCL::NO-METHODS</code>, <code>SB-PCL::DEFAULT-METHOD-ONLY</code>,
|
|
<code>SB-PCL::CONSTANT-VALUE</code>), for slot access
|
|
(<code>SB-PCL::ONE-CLASS</code>, <code>SB-PCL::TWO-CLASS</code>,
|
|
<code>SB-PCL::ONE-INDEX</code>, <code>SB-PCL::N-N</code><a rel="footnote" href="The-Initial-Discriminating-Function.html#fn-1" name="fnd-1"><sup>1</sup></a>), or for dispatch based
|
|
on its arguments (<code>SB-PCL::CACHING</code>, <code>SB-PCL::DISPATCH</code>).
|
|
Those in the second category can transition into the third, or into a
|
|
<code>SB-PCL::CHECKING</code> state where the choice between
|
|
<code>SB-PCL::CACHING</code> and <code>SB-PCL::DISPATCH</code> has not yet been
|
|
made.
|
|
|
|
<p>The possible transitions are shown in <a href="fig_003adfun_002dtransitions.html#fig_003adfun_002dtransitions">Figure 3.1</a>.
|
|
|
|
<div class="footnote">
|
|
<hr>
|
|
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="The-Initial-Discriminating-Function.html#fnd-1">1</a>]</small> Would be better
|
|
named as <code>M-N</code>, as there is no requirement for the number of
|
|
classes and number of indices to be the same.</p>
|
|
|
|
<hr></div>
|
|
|
|
</body></html>
|
|
|