1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-17 17:58:46 +00:00

Fix eieio vs cl-generic incompatibilities found in Rudel (bug#23947)

* lisp/emacs-lisp/cl-generic.el (cl-generic-apply): New function.
* lisp/emacs-lisp/eieio-compat.el (eieio--defmethod): Fix incorrect
mapping between cl-no-applicable-method and EIEIO's no-applicable-method.
* lisp/emacs-lisp/eieio-core.el (eieio--class-precedence-c3):
`class' is not a symbol but a class object.
This commit is contained in:
Stefan Monnier 2016-07-14 15:05:49 -04:00
parent 248d5dd13c
commit 452aa949bc
3 changed files with 13 additions and 3 deletions

View File

@ -671,6 +671,15 @@ FUN is the function that should be called when METHOD calls
(setq fun (cl-generic-call-method generic method fun)))
fun)))))
(defun cl-generic-apply (generic args)
"Like `apply' but takes a cl-generic object rather than a function."
;; Handy in cl-no-applicable-method, for example.
;; In Common Lisp, generic-function objects are funcallable. Ideally
;; we'd want the same in Elisp, but it would either require using a very
;; different (and less efficient) representation of cl--generic objects,
;; or non-trivial changes in the general infrastructure (compiler and such).
(apply (cl--generic-name generic) args))
(defun cl--generic-arg-specializer (method dispatch-arg)
(or (if (integerp dispatch-arg)
(nth dispatch-arg

View File

@ -188,7 +188,8 @@ Summary:
(`no-applicable-method
(setq method 'cl-no-applicable-method)
(setq specializers `(generic ,@specializers))
(lambda (generic arg &rest args) (apply code arg generic args)))
(lambda (generic arg &rest args)
(apply code arg (cl--generic-name generic) (cons arg args))))
(_ code))))
(cl-generic-define-method
method (unless (memq kind '(nil :primary)) (list kind))

View File

@ -976,7 +976,7 @@ If a consistent order does not exist, signal an error."
(defun eieio--class-precedence-c3 (class)
"Return all parents of CLASS in c3 order."
(let ((parents (eieio--class-parents (cl--find-class class))))
(let ((parents (eieio--class-parents class)))
(eieio--c3-merge-lists
(list class)
(append
@ -1101,7 +1101,7 @@ method invocation orders of the involved classes."
(list eieio--generic-subclass-generalizer))
;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "6aca3c1b5f751a01331761da45fc4f5c")
;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "dba4205b1a0d7133f1311d975b4d0ebe")
;;; Generated autoloads from eieio-compat.el
(autoload 'eieio--defalias "eieio-compat" "\