]> git.eshelyaron.com Git - emacs.git/commit
(cl-deftype): Precompute the predicate function
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 8 May 2025 03:17:41 +0000 (23:17 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:54:49 +0000 (10:54 +0200)
commit990dc985ec8ef4940484f4fd7c042c72d37a9d22
treef4cf49529fa8257601483eb9c62252d10f27fc41
parenta03599beed0b69d1094d9f4619e3a141895b05f6
(cl-deftype): Precompute the predicate function

Always define a `cl-deftype-satisfies` predicate (if possible), so
we only need `cl-typep` to "interpret" a type specifier when we use
a compound type but never for the atomic types (e.g. never
in `cl-types-of`).

* lisp/emacs-lisp/cl-macs.el (cl-typep): Test `cl-deftype-satisfies` first.
Don't handle `real` here any more.
(base-char, character, command, keyword, natnum, real): Define with
`c-deftype`.
(cl-deftype): Precompute the predicate for the atomic derived type,
if applicable.

* lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type):
Add argument for the precomputed predicate function.

* lisp/emacs-lisp/cl-extra.el (cl-types-of): Use `cl-deftype-satisfies`
instead of `cl-type-p`.

(cherry picked from commit 777da8c3f9ea73077c00957d48d8e6b317b9657d)
lisp/emacs-lisp/cl-extra.el
lisp/emacs-lisp/cl-macs.el
lisp/emacs-lisp/cl-preloaded.el