concept-type-intro.tex 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. % -*- Mode: TeX -*-
  2. %% Introduction to Objects and Types
  3. %% 2.0.0 4
  4. %% 6.2.1 1
  5. A \term{type} is a (possibly infinite) set of \term{objects}.
  6. An \term{object} can belong to more than one \term{type}.
  7. \term{Types} are never explicitly represented as \term{objects} by \clisp.
  8. Instead, they are referred to indirectly by the use of \term{type specifiers},
  9. which are \term{objects} that denote \term{types}.
  10. New \term{types} can be defined using \macref{deftype}, \macref{defstruct},
  11. \macref{defclass}, and \macref{define-condition}.
  12. \Thefunction{typep}, a set membership test, is used to determine
  13. whether a given \term{object} is of a given \term{type}. The function
  14. \funref{subtypep}, a subset test, is used to determine whether a
  15. given \term{type} is a \term{subtype} of another given \term{type}. The
  16. function \funref{type-of} returns a particular \term{type} to
  17. which a given \term{object} belongs, even though that \term{object}
  18. must belong to one or more other \term{types} as well.
  19. (For example, every \term{object} is \oftype{t},
  20. but \funref{type-of} always returns a \term{type specifier}
  21. for a \term{type} more specific than \typeref{t}.)
  22. %% 2.0.0 1
  23. \term{Objects}, not \term{variables}, have \term{types}.
  24. Normally, any \term{variable} can have any \term{object} as its \term{value}.
  25. It is possible to declare that a \term{variable} takes on only
  26. values of a given \term{type} by making an explicit \term{type declaration}.
  27. %% 2.0.0 5
  28. \term{Types} are arranged in a directed acyclic graph, except
  29. for the presence of equivalences.
  30. \term{Declarations} can be made about \term{types} using \misc{declare},
  31. \funref{proclaim}, \macref{declaim}, or \specref{the}.
  32. For more information about \term{declarations},
  33. \seesection\Declarations.
  34. Among the fundamental \term{objects} of the \CLOS\ are \term{classes}.
  35. A \term{class} determines the structure and behavior of a set of
  36. other \term{objects}, which are called its \term{instances}.
  37. Every \term{object} is a \term{direct instance} of a \term{class}.
  38. The \term{class} of an \term{object} determines the set of
  39. operations that can be performed on the \term{object}.
  40. For more information, \seesection\Classes.
  41. It is possible to write \term{functions} that have behavior \term{specialized}
  42. to the class of the \term{objects} which are their \term{arguments}.
  43. For more information, \seesection\GFsAndMethods.
  44. The \term{class} of the \term{class} of an \term{object}
  45. is called its \newterm{metaclass}.
  46. For more information about \term{metaclasses},
  47. \seesection\MetaObjects.