From: Andrea Corallo Date: Thu, 15 Feb 2024 15:10:59 +0000 (+0100) Subject: * Add initial "Type Hierarchy" node to the elisp manual X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7b0b57e8563273a6e46eb14238066d3e0fb05e6c;p=emacs.git * Add initial "Type Hierarchy" node to the elisp manual * doc/lispref/objects.texi (Lisp Data Types, Type Hierarchy): Add Type Hierarchy node. (cherry picked from commit 74f060230f70ba986a1c78e4e0d1181492567597) --- diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index e6def69454e..01f82d56528 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -60,6 +60,7 @@ to use these types can be found in later chapters. * Type Predicates:: Tests related to types. * Equality Predicates:: Tests of equality between any two objects. * Mutability:: Some objects should not be modified. +* Type Hierarchy:: Type Hierarchy. @end menu @node Printed Representation @@ -2496,3 +2497,23 @@ their components. For example, @code{(eq "abc" "abc")} returns literal @code{"abc"}, and returns @code{nil} if it creates two instances. Lisp programs should be written so that they work regardless of whether this optimization is in use. + +@node Type Hierarchy + +Lisp types are organized in a hierarchy, this means that types can +derive from other types. Objects of a type A (which derives from type +B) inherite all the charateristics of type B. This also means that +every objects of type A is at the same time of type B. + +Every type derives from type @code{t}. + +New types can be defined by the user through @code{defclass} or +@code{cl-defstruct}. + +The Lisp Type Hierarchy for primitive types can be represented as +follow: + +@image{type_hierarchy,,,,png} + +For example type @code{list} derives from (is a special kind of) type +@code{sequence} wich on itself derives from @code{t}.