]> git.eshelyaron.com Git - emacs.git/commitdiff
cl-preloaded.el: Further fine-tuning
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 5 Mar 2024 04:12:29 +0000 (23:12 -0500)
committerEshel Yaron <me@eshelyaron.com>
Tue, 5 Mar 2024 15:35:04 +0000 (16:35 +0100)
* lisp/emacs-lisp/cl-preloaded.el (cl--direct-supertypes-of-type):
Fix some left over issues:
- Remove redundant `number-or-marker` from `marker`s parents.
- Add `function` to the types, since it was missing.
(cl--typeof-types): Add a warning for missing type info.

* admin/syncdoc-type-hierarchy.el (syncdoc-hierarchy): Fix parent of
`oclosure`.

* doc/lispref/type_hierarchy.txt:
* doc/lispref/type_hierarchy.jpg: Update.

(cherry picked from commit 418ad866bf846a6a3328d91df28c958be75337be)

admin/syncdoc-type-hierarchy.el
doc/lispref/type_hierarchy.jpg
doc/lispref/type_hierarchy.txt
lisp/emacs-lisp/cl-preloaded.el

index cb4df63a312ab04c3cd440ff105f14b2f93ea8b8..6448369625bbf86145653ad9ec541958caccf247 100644 (file)
@@ -69,7 +69,7 @@
                                  (not (eq type 'eieio-default-superclass)))
                             '(eieio-default-superclass))
                            ;; OClosures can still be lists :-(
-                           ((eq 'oclosure type) '(t))
+                           ((eq 'oclosure type) '(function))
                            (t '(atom)))
                      ht)))))
     ht))
index b7eba7d1cf7a8c07a479b13db6e059a3810fad13..6b9be98581762073999158a2b8bf6e91801b4be4 100644 (file)
Binary files a/doc/lispref/type_hierarchy.jpg and b/doc/lispref/type_hierarchy.jpg differ
index c74bc45635b6d44d07c56406b22763840e0a11b1..6827bbbc58002666bde98c8f522cc71edb82f7c6 100644 (file)
@@ -1,22 +1,27 @@
-| Type              | Derived Types                                            |
-|-------------------+----------------------------------------------------------|
-| t                 | sequence atom                                            |
-| sequence          | list array                                               |
-| atom              | class structure tree-sitter-compiled-query               |
-|                   | tree-sitter-node tree-sitter-parser user-ptr font-object |
-|                   | font-entity font-spec condvar mutex thread terminal      |
-|                   | hash-table frame buffer function window process          |
-|                   | window-configuration overlay integer-or-marker           |
-|                   | number-or-marker symbol array obarray                    |
-| number            | float integer                                            |
-| number-or-marker  | marker number                                            |
-| integer           | bignum fixnum                                            |
-| symbol            | keyword boolean symbol-with-pos                          |
-| array             | vector bool-vector char-table string                     |
-| list              | null cons                                                |
-| integer-or-marker | integer marker                                           |
-| compiled-function | byte-code-function                                       |
-| function          | subr module-function compiled-function                   |
-| boolean           | null                                                     |
-| subr              | subr-native-elisp subr-primitive                         |
-| symbol-with-pos   | keyword                                                  |
+| Type                     | Derived Types                                              |
+|--------------------------+------------------------------------------------------------|
+| t                        | sequence atom                                              |
+| sequence                 | list array                                                 |
+| atom                     | array function tree-sitter-compiled-query tree-sitter-node |
+|                          | tree-sitter-parser user-ptr font-object font-entity        |
+|                          | font-spec condvar mutex thread terminal hash-table frame   |
+|                          | buffer window process window-configuration overlay         |
+|                          | number-or-marker symbol obarray native-comp-unit           |
+|                          | cl-structure-object eieio-default-superclass               |
+| number                   | float integer                                              |
+| integer-or-marker        | integer marker                                             |
+| number-or-marker         | integer-or-marker number                                   |
+| integer                  | bignum fixnum                                              |
+| symbol                   | keyword boolean symbol-with-pos                            |
+| array                    | vector bool-vector char-table string                       |
+| boolean                  | null                                                       |
+| list                     | null cons                                                  |
+| compiled-function        | byte-code-function subr                                    |
+| function                 | module-function compiled-function oclosure                 |
+| subr                     | subr-native-elisp subr-primitive                           |
+| oclosure                 | advice kmacro                                              |
+| cl--class                | oclosure--class cl-structure-class eieio--class            |
+| cl-structure-object      | cl--class xref-elisp-location frameset-register            |
+| eieio-default-superclass | eieio-named transient-child                                |
+| transient-suffix         | transient-infix                                            |
+| transient-child          | transient-suffix                                           |
index a4ddc55b2579aacb85c23ffd0c5af197614eb9a8..ea08d35ecec14fc661e8a8a1a96f6994b7508add 100644 (file)
       (signal 'cl-assertion-failed `(,form ,@sargs)))))
 
 (defconst cl--direct-supertypes-of-type
+  ;; Please run `sycdoc-update-type-hierarchy' in
+  ;; `admin/syncdoc-type-hierarchy.el' each time this is modified to
+  ;; reflect the change in the documentation.
   (let ((table (make-hash-table :test #'eq)))
+    ;; FIXME: Our type DAG has various quirks:
+    ;; - `subr' says it's a `compiled-function' but that's not true
+    ;;   for those subrs that are special forms!
+    ;; - Some `keyword's are also `symbol-with-pos' but that's not reflected
+    ;;   in the DAG.
+    ;; - An OClosure can be an interpreted function or a `byte-code-function',
+    ;;   so the DAG of OClosure types is "orthogonal" to the distinction
+    ;;   between interpreted and compiled functions.
     (dolist (x '((sequence t)
                  (atom t)
                  (list sequence)
                  (array sequence atom)
                  (float number)
                  (integer number integer-or-marker)
-                 (marker integer-or-marker number-or-marker)
+                 (marker integer-or-marker)
                  (integer-or-marker number-or-marker)
                  (number number-or-marker)
                  (bignum integer)
                  ;; FIXME: This results in `atom' coming before `list' :-(
                  (null boolean list)
                  (cons list)
+                 (function atom)
                  (byte-code-function compiled-function)
                  (subr compiled-function)
-                 (module-function function atom)
-                 (compiled-function function atom)
+                 (module-function function)
+                 (compiled-function function)
                  (subr-native-elisp subr)
                  (subr-primitive subr)))
       (puthash (car x) (cdr x) table))
             (lambda (type)
               ;; FIXME: copy&pasted from `cl--class-allparents'.
               (let ((parents (gethash type cl--direct-supertypes-of-type)))
+                (unless parents
+                  (message "Warning: Type without parent: %S!" type))
                 (cons type
                       (merge-ordered-lists
+                       ;; FIXME: Can't remember why `t' is excluded.
                        (mapcar allparents (remq t parents))))))))
     (maphash (lambda (type _)
               (push (funcall allparents type) alist))