% -*- Mode: TeX -*- %% Introduction to Objects and Types %% 2.0.0 4 %% 6.2.1 1 A \term{type} is a (possibly infinite) set of \term{objects}. An \term{object} can belong to more than one \term{type}. \term{Types} are never explicitly represented as \term{objects} by \clisp. Instead, they are referred to indirectly by the use of \term{type specifiers}, which are \term{objects} that denote \term{types}. New \term{types} can be defined using \macref{deftype}, \macref{defstruct}, \macref{defclass}, and \macref{define-condition}. \Thefunction{typep}, a set membership test, is used to determine whether a given \term{object} is of a given \term{type}. The function \funref{subtypep}, a subset test, is used to determine whether a given \term{type} is a \term{subtype} of another given \term{type}. The function \funref{type-of} returns a particular \term{type} to which a given \term{object} belongs, even though that \term{object} must belong to one or more other \term{types} as well. (For example, every \term{object} is \oftype{t}, but \funref{type-of} always returns a \term{type specifier} for a \term{type} more specific than \typeref{t}.) %% 2.0.0 1 \term{Objects}, not \term{variables}, have \term{types}. Normally, any \term{variable} can have any \term{object} as its \term{value}. It is possible to declare that a \term{variable} takes on only values of a given \term{type} by making an explicit \term{type declaration}. %% 2.0.0 5 \term{Types} are arranged in a directed acyclic graph, except for the presence of equivalences. \term{Declarations} can be made about \term{types} using \misc{declare}, \funref{proclaim}, \macref{declaim}, or \specref{the}. For more information about \term{declarations}, \seesection\Declarations. Among the fundamental \term{objects} of the \CLOS\ are \term{classes}. A \term{class} determines the structure and behavior of a set of other \term{objects}, which are called its \term{instances}. Every \term{object} is a \term{direct instance} of a \term{class}. The \term{class} of an \term{object} determines the set of operations that can be performed on the \term{object}. For more information, \seesection\Classes. It is possible to write \term{functions} that have behavior \term{specialized} to the class of the \term{objects} which are their \term{arguments}. For more information, \seesection\GFsAndMethods. The \term{class} of the \term{class} of an \term{object} is called its \newterm{metaclass}. For more information about \term{metaclasses}, \seesection\MetaObjects.