Common Lisp the Language, 2nd Edition
Next: Error Terminology
Up: Common Lisp Object
Previous: Common Lisp
Object
The Common Lisp Object System (CLOS) is an object-oriented extension to
Common Lisp. It is based on generic functions, multiple inheritance,
declarative method combination, and a meta-object protocol.
The first two parts of this specification describe the standard Programmer Interface for the Common Lisp Object System. The first part, Programmer Interface Concepts, contains a description of the concepts of the Common Lisp Object System, and the second part, Functions in the Programmer Interface, contains a description of the functions and macros in the Common Lisp Object System Programmer Interface. The third part, The Common Lisp Object System Meta-Object Protocol, explains how the Common Lisp Object System can be customized. [The third part has not yet been approved by X3J13 for inclusion in the forthcoming Common Lisp standard and is not included in this book.-GLS]
The fundamental objects of the Common Lisp Object System are classes, instances, generic functions, and methods.
A class object determines the structure and behavior of a set of other objects, which are called its instances. Every Common Lisp object is an instance of a class. The class of an object determines the set of operations that can be performed on the object.
A generic function is a function whose behavior depends on the classes or identities of the arguments supplied to it. A generic function object contains a set of methods, a lambda-list, a method combination type, and other information. The methods define the class-specific behavior and operations of the generic function; a method is said to specialize a generic function. When invoked, a generic function executes a subset of its methods based on the classes of its arguments.
A generic function can be used in the same ways as an ordinary
function in Common Lisp; in particular, a generic function can be used
as an argument to funcall
and apply
and can be
given a global or a local name.
A method is an object that contains a method function, a sequence of parameter specializers that specify when the given method is applicable, and a sequence of qualifiers that is used by the method combination facility to distinguish among methods. Each required formal parameter of each method has an associated parameter specializer, and the method will be invoked only on arguments that satisfy its parameter specializers.
The method combination facility controls the selection of methods,
the order in which they are run, and the values that are returned by the
generic function. The Common Lisp Object System offers a default method
combination type and provides a facility for declaring new types of
method combination.
Next: Error Terminology
Up: Common Lisp Object
Previous: Common Lisp
Object
AI.Repository@cs.cmu.edu