[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/type-hierarchy 74f060230f7 3/5: * Add initial "Type Hierarchy" n
From: |
Andrea Corallo |
Subject: |
feature/type-hierarchy 74f060230f7 3/5: * Add initial "Type Hierarchy" node to the elisp manual |
Date: |
Thu, 15 Feb 2024 12:03:30 -0500 (EST) |
branch: feature/type-hierarchy
commit 74f060230f70ba986a1c78e4e0d1181492567597
Author: Andrea Corallo <acorallo@gnu.org>
Commit: Andrea Corallo <acorallo@gnu.org>
* Add initial "Type Hierarchy" node to the elisp manual
* doc/lispref/objects.texi (Lisp Data Types, Type Hierarchy): Add
Type Hierarchy node.
---
doc/lispref/objects.texi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index b8fd5ed4345..18484bac368 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
@@ -2493,3 +2494,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}.