[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/fcr f2d8a24: Fix bootstrap problems and various misc issues foun
From: |
Stefan Monnier |
Subject: |
scratch/fcr f2d8a24: Fix bootstrap problems and various misc issues found along the way |
Date: |
Fri, 17 Dec 2021 14:53:10 -0500 (EST) |
branch: scratch/fcr
commit f2d8a24e21c7c83fa92c36bf8cee991dca7ec6a1
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Fix bootstrap problems and various misc issues found along the way
* lisp/simple.el (function-docstring): Fix call to `signal`.
* lisp/emacs-lisp/fcr.el (fcr--define): Use `cl-deftype-satisfies`.
* lisp/emacs-lisp/cl-generic.el (cl--generic-prefill-dispatchers):
Bind `cl--generic-compiler` around the right part of the function (duh!).
---
lisp/emacs-lisp/cl-generic.el | 24 ++++++++++++++----------
lisp/emacs-lisp/fcr.el | 5 ++---
lisp/simple.el | 2 +-
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 5e7b815..7a2a397 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -880,16 +880,20 @@ those methods.")
(setq arg-or-context `(&context . ,arg-or-context)))
(unless (fboundp 'cl--generic-get-dispatcher)
(require 'cl-generic))
- (let ((fun (cl--generic-get-dispatcher
- `(,arg-or-context
- ,@(apply #'append
- (mapcar #'cl-generic-generalizers specializers))
- ,cl--generic-t-generalizer)))
- ;; When compiling `cl-generic' during bootstrap, make sure
- ;; we prefill with compiled dispatchers even though the loaded
- ;; `cl-generic' is still interpreted.
- (cl--generic-compiler
- (if (featurep 'bytecomp) #'byte-compile cl--generic-compiler)))
+ (let ((fun
+ ;; Let-bind cl--generic-dispatchers so we *re*compute the function
+ ;; from scratch, since the one in the cache may be non-compiled!
+ (let ((cl--generic-dispatchers (make-hash-table))
+ ;; When compiling `cl-generic' during bootstrap, make sure
+ ;; we prefill with compiled dispatchers even though the loaded
+ ;; `cl-generic' is still interpreted.
+ (cl--generic-compiler
+ (if (featurep 'bytecomp) #'byte-compile cl--generic-compiler)))
+ (cl--generic-get-dispatcher
+ `(,arg-or-context
+ ,@(apply #'append
+ (mapcar #'cl-generic-generalizers specializers))
+ ,cl--generic-t-generalizer)))))
;; Recompute dispatch at run-time, since the generalizers may be slightly
;; different (e.g. byte-compiled rather than interpreted).
;; FIXME: There is a risk that the run-time generalizer is not equivalent
diff --git a/lisp/emacs-lisp/fcr.el b/lisp/emacs-lisp/fcr.el
index 4e2b5c6..d559ab3 100644
--- a/lisp/emacs-lisp/fcr.el
+++ b/lisp/emacs-lisp/fcr.el
@@ -180,11 +180,10 @@
(defun fcr--define (class pred)
(let* ((name (cl--class-name class))
- (predname (intern (format "fcr--%s-p" name)))
- (type `(satisfies ,predname)))
+ (predname (intern (format "fcr--%s-p" name))))
(setf (cl--find-class name) class)
(defalias predname pred)
- (put name 'cl-deftype-handler (lambda () type))))
+ (put name 'cl-deftype-satisfies predname)))
(defmacro fcr-lambda (type fields args &rest body)
(declare (indent 3) (debug (sexp (&rest (sexp form)) sexp def-body)))
diff --git a/lisp/simple.el b/lisp/simple.el
index 09e1c7d..ffb1331 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2343,7 +2343,7 @@ FUNCTION is expected to be a function value rather than,
say, a mere symbol."
;; in the function body, so reject them if they are last.
(cdr body))
doc)))
- (_ (signal 'invalid-function))))
+ (_ (signal 'invalid-function (list function)))))
(cl-defgeneric interactive-form (cmd)
"Return the interactive form of CMD or nil if none.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- scratch/fcr f2d8a24: Fix bootstrap problems and various misc issues found along the way,
Stefan Monnier <=