* Primitive Function Type:: A function written in C, callable from Lisp.
* Byte-Code Type:: A function written in Lisp, then compiled.
* Record Type:: Compound objects with programmer-defined types.
+* Type Descriptors:: Objects holding information about types.
* Autoload Type:: A type used for automatically loading seldom-used
functions.
* Finalizer Type:: Runs code when no longer reachable.
* Primitive Function Type:: A function written in C, callable from Lisp.
* Byte-Code Type:: A function written in Lisp, then compiled.
* Record Type:: Compound objects with programmer-defined types.
+* Type Descriptors:: Objects holding information about types.
* Autoload Type:: A type used for automatically loading seldom-used
functions.
* Finalizer Type:: Runs code when no longer reachable.
@xref{Records}, for functions that work with records.
+@node Type Descriptors
+@subsection Type Descriptors
+
+ A @dfn{type decriptor} is a @code{record} which holds information
+about a type. Slot 1 in the record must be a symbol naming the type.
+@code{type-of} relies on this to return the type of @code{record}
+objects. No other type descriptor slot is used by Emacs; they are
+free for use by Lisp extensions.
+
+An example of a type descriptor is any instance of
+@code{cl-structure-class}.
+
@node Autoload Type
@subsection Autoload Type
@code{marker}, @code{mutex}, @code{overlay}, @code{process},
@code{string}, @code{subr}, @code{symbol}, @code{thread},
@code{vector}, @code{window}, or @code{window-configuration}.
-However, if @var{object} is a record, its first slot is returned.
+However, if @var{object} is a record, the type specified by its first
+slot is returned; @ref{Records}.
@example
(type-of 1)
can be much larger. Like arrays, records use zero-origin indexing:
the first slot has index 0.
+ The type slot should be a symbol or a type descriptor. If it's a
+type descriptor, the symbol naming its type will be returned;
+@ref{Type Descriptors}. Any other kind of object is returned as-is.
+
The printed representation of records is @samp{#s} followed by a
list specifying the contents. The first list element must be the
record type. The following elements are the record slots.
DEFUN ("make-record", Fmake_record, Smake_record, 3, 3, 0,
doc: /* Create a new record.
-TYPE is its type as returned by `type-of'. SLOTS is the number of
-non-type slots, each initialized to INIT. */)
+TYPE is its type as returned by `type-of'; it should be either a
+symbol or a type descriptor. SLOTS is the number of non-type slots,
+each initialized to INIT. */)
(Lisp_Object type, Lisp_Object slots, Lisp_Object init)
{
CHECK_NATNUM (slots);
DEFUN ("record", Frecord, Srecord, 1, MANY, 0,
doc: /* Create a new record.
-TYPE is its type as returned by `type-of'. SLOTS is used to
-initialize the record slots with shallow copies of the arguments.
+TYPE is its type as returned by `type-of'; it should be either a
+symbol or a type descriptor. SLOTS is used to initialize the record
+slots with shallow copies of the arguments.
usage: (record TYPE &rest SLOTS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{