bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache


From: Stefan Monnier
Subject: bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el
Date: Sat, 17 Jan 2015 09:43:18 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> (defmethod constructor :static ((x testing) newname &rest args)
>   (message "Constructor")
>   (call-next-method))

Indeed, in Emacs-25, EIEIO's object names have been mostly dropped
(with some backward compatibility).  In this case, the backward
compatibility was broken.

Hmm... let me see if we can try to better preserve the backward
compatibility here.  OK, I installed the patch below which should help.

Note that this `newname' argument won't be provided in Emacs-25 if you
use `make-instance', so you should try and change your code to use
eieio-named objects instead, if you need your objects to have a name.


        Stefan


--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -276,12 +276,6 @@ and reference them using the function `class-option'."
           `(defun ,name (&rest slots)
              ,(format "Create a new object with name NAME of class type %S."
                       name)
-             (if (and slots
-                      (let ((x (car slots)))
-                        (or (stringp x) (null x))))
-                 (funcall (if eieio-backward-compatibility #'ignore #'message)
-                          "Obsolete name %S passed to %S constructor"
-                          (pop slots) ',name))
              (apply #'eieio-constructor ',name slots))))))
 
 
@@ -656,7 +650,14 @@ SLOTS are the initialization slots used by 
`shared-initialize'.
 This static method is called when an object is constructed.
 It allocates the vector used to represent an EIEIO object, and then
 calls `shared-initialize' on that object."
-  (let* ((new-object (copy-sequence (eieio--class-default-object-cache 
(eieio--class-v class)))))
+  (let* ((new-object (copy-sequence (eieio--class-default-object-cache
+                                     (eieio--class-v class)))))
+    (if (and slots
+             (let ((x (car slots)))
+               (or (stringp x) (null x))))
+        (funcall (if eieio-backward-compatibility #'ignore #'message)
+                 "Obsolete name %S passed to %S constructor"
+                 (pop slots) class))
     ;; Call the initialize method on the new object with the slots
     ;; that were passed down to us.
     (initialize-instance new-object slots)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]