29.1. Introduction

29.1.1. Notation
29.1.2. Package

The CLOS specification ([ANSI CL standard] Chanpter 7) describes the standard Programmer Interface for the Common Lisp Object System (CLOS). This document extends that specification by defining a metaobject protocol for CLOS - that is, a description of CLOS itself as an extensible CLOS program. In this description, the fundamental elements of CLOS programs (classes, slot definitions, generic functions, methods, specializers and method combinations) are represented by first-class objects. The behavior of CLOS is provided by these objects, or, more precisely, by methods specialized to the classes of these objects.

Because these objects represent pieces of CLOS programs, and because their behavior provides the behavior of the CLOS language itself, they are considered meta-level objects or metaobjects. The protocol followed by the metaobjects to provide the behavior of CLOS is called the CLOS Metaobject Protocol (MOP).

29.1.1. Notation

The description of functions follows the same form as used in the CLOS specification. The description of generic functions is similar to that in the CLOS specification, but some minor changes have been made in the way methods are presented.

The following is an example of the format for the syntax description of a generic function:

(gf1 x y &OPTIONAL v &KEY k)

This description indicates that gf1 is a generic function with two required parameters, x and y, an optional parameter v and a keyword parameter k.

The description of a generic function includes a description of its behavior. This provides the general behavior, or protocol of the generic function. All methods defined on the generic function, both portable and specified, must have behavior consistent with this description.

Every generic function described here is an instance of the class STANDARD-GENERIC-FUNCTION and uses the STANDARD method combination.

The description of a generic function also includes descriptions of the specified methods for that generic function. In the description of these methods, a method signature is used to describe the parameters and parameter specializers of each method. The following is an example of the format for a method signature:

(gf1 (x CLASS) y &OPTIONAL v &KEY k)

This signature indicates that this primary method on the generic function gf1 has two required parameters, named x and y. In addition, there is an optional parameter v and a keyword parameter k. This signature also indicates that the method's parameter specializers are the classes CLASS and T.

The description of each method includes a description of the behavior particular to that method.

An abbreviated syntax is used when referring to a method defined elsewhere in the document. This abbreviated syntax includes the name of the generic function, the qualifiers, and the parameter specializers. A reference to the method with the signature shown above is written as: gf1 (CLASS T).

29.1.2. Package

The package exporting the Meta-Object Protocol symbols is unspecified.

Implementation dependent: only in CLISP

The symbols specified by the Meta-Object Protocol are exported from the package CLOS and EXT:RE-EXPORTed from the package EXT.

The package exporting the Meta-Object Protocol symbols is different in other implementations: In SBCL it is the package SB-MOP; in OpenMCL it is the package OPENMCL-MOP.

These notes document CLISP version 2.49Last modified: 2010-07-07