emacs.d/clones/www.sbcl.org/sbcl-internals/Discriminating-Functions.html
2023-01-18 20:30:47 +01:00

75 lines
3.7 KiB
HTML

<html lang="en">
<head>
<title>Discriminating Functions - 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="prev" href="Calling-Convention.html#Calling-Convention" title="Calling Convention">
<link rel="next" href="Foreign-Linkage.html#Foreign-Linkage" title="Foreign Linkage">
<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="Discriminating-Functions"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Foreign-Linkage.html#Foreign-Linkage">Foreign Linkage</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Calling-Convention.html#Calling-Convention">Calling Convention</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<!-- node-name, next, previous, up -->
<h2 class="chapter">3 Discriminating Functions</h2>
<ul class="menu">
<li><a accesskey="1" href="The-Initial-Discriminating-Function.html#The-Initial-Discriminating-Function">The Initial Discriminating Function</a>
<li><a accesskey="2" href="Method_002dBased-Discriminating-Functions.html#Method_002dBased-Discriminating-Functions">Method-Based Discriminating Functions</a>
<li><a accesskey="3" href="Accessor-Discriminating-Functions.html#Accessor-Discriminating-Functions">Accessor Discriminating Functions</a>
<li><a accesskey="4" href="Cacheing-and-Dispatch-Functions.html#Cacheing-and-Dispatch-Functions">Cacheing and Dispatch Functions</a>
<li><a accesskey="5" href="The-Cacheing-Mechanism.html#The-Cacheing-Mechanism">The Cacheing Mechanism</a>
</ul>
<p>The Common Lisp Object System specifies a great deal of run-time
customizeability, such as class redefinition, generic function and
method redefinition, addition and removal of methods and redefinitions
of method combinations. The additional flexibility defined by the
Metaobject Protocol, specifying the generic functions called to achieve
the effects of CLOS operations (and allowing many of them to be
overridden by the user) makes any form of optimization seem intractable.
And yet such optimization is necessary to achieve reasonable
performance: the MOP specifies that a slot access looks up the class of
the object, and the slot definition from that class and the slot name,
and then invokes a generic function specialized on those three
arguments. This is clearly going to act against the user's intuition
that a slot access given an instance should be relatively fast.
<p>The optimizations performed cannot be done wholly at compile-time,
however, thanks to all of these possibilities for run-time redefinition
and extensibility. This section describes the optimizations performed
in SBCL's CLOS implementation in computing and calling the effective
method for generic functions.
</body></html>