]> git.eshelyaron.com Git - emacs.git/commitdiff
* Add initial "Type Hierarchy" node to the elisp manual
authorAndrea Corallo <acorallo@gnu.org>
Thu, 15 Feb 2024 15:10:59 +0000 (16:10 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 2 Mar 2024 06:28:42 +0000 (07:28 +0100)
* doc/lispref/objects.texi (Lisp Data Types, Type Hierarchy): Add
Type Hierarchy node.

(cherry picked from commit 74f060230f70ba986a1c78e4e0d1181492567597)

doc/lispref/objects.texi

index e6def69454e259c56d54e7d7b1c4aef1aedd1ec7..01f82d5652890989ecc6e5b9e27c3c3c4c9b5cd6 100644 (file)
@@ -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}.