Method Lookup question

Vassili Bykov vassili at objectpeople.com
Thu Sep 9 13:48:59 UTC 1999


>[...]
>     So I thought that maybe instead of asking a class for the
> implementation
> of a selector, I ask the selector for the implementation for a
> given class.
> In this case, the "selector" would be like the "type"...
>     The selector should have a method that returns its
> implementation for a
> given class. This method could have different "strategies" depending on
> the amount of classes that implement the selector, how often a selector is
> used for a given class, etc.

This is how CLOS works.  Selector from your terminology is a generic
function (or more exactly a combination of a binding of a name to a GF and
the GF itself), and a particular implementation is a method--in CLOS, not
Smalltalk sense.  The method answering an implementation of a selector is a
seedling of a MOP.

For a description of CLOS and MOP, read _The Art of the Metaobject
Protocol_.  There is a (somewhat terse) paper about Symbolics CLOS
optimization techniques, both on Lisp machine  and stock hardware, available
somewhere online; AltaVista can find it for you.

--
Vassili Bykov        <vassili at objectpeople.com>
The Object People    <http://www.objectpeople.com>
  "Any sufficiently complicated C or Fortran program contains
  an ad-hoc, informally-specified bug-ridden slow implementation
  of half of Common Lisp."  --Greenspun's Tenth Rule of Programming





More information about the Squeak-dev mailing list