all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el
@ 2015-01-17  4:56 Kirill Ignatiev
  2015-01-17  5:43 ` Thierry Volpiatto
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kirill Ignatiev @ 2015-01-17  4:56 UTC (permalink / raw
  To: 19620

The following code (essentially taken from pcache.el) used to work
fine until recently (worked fine in 24.4 and in some recent git head),
but gives a wrong-number-of-arguments error in current git head:

(require 'eieio)
(require 'eieio-generic)

(defclass testing ()
  ())

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

(testing "test")

I haven't really used eieio, so I can't be sure what went wrong. Emacs
used to accept this code and run this without errors, so I assume the
code is actually correct.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el
  2015-01-17  4:56 bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el Kirill Ignatiev
@ 2015-01-17  5:43 ` Thierry Volpiatto
  2015-01-17 14:12   ` Stefan Monnier
  2015-01-17  5:59 ` Kirill Ignatiev
  2015-01-17 14:43 ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: Thierry Volpiatto @ 2015-01-17  5:43 UTC (permalink / raw
  To: 19620

Kirill Ignatiev <kirill.ignatiev@gmail.com> writes:

> The following code (essentially taken from pcache.el) used to work
> fine until recently (worked fine in 24.4 and in some recent git head),
> but gives a wrong-number-of-arguments error in current git head:

You have to recompile all the packages compiled with 24.4 when switching
to 25.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el
  2015-01-17  4:56 bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el Kirill Ignatiev
  2015-01-17  5:43 ` Thierry Volpiatto
@ 2015-01-17  5:59 ` Kirill Ignatiev
  2015-01-17 14:43 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Kirill Ignatiev @ 2015-01-17  5:59 UTC (permalink / raw
  To: 19620; +Cc: thierry.volpiatto

> You have to recompile all the packages compiled with 24.4 when switching to 25.

I did recompile pcache while figuring out a reduced test case, but I
don't see how that's relevant here. I observe this change of behaviour
on this specific test case when starting emacs with -Q and using only
the eieio package, which is built-in, so it was compiled when emacs
was compiled. That pcache fails because of this is just how I found
out that there might be some problem there.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el
  2015-01-17  5:43 ` Thierry Volpiatto
@ 2015-01-17 14:12   ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2015-01-17 14:12 UTC (permalink / raw
  To: Thierry Volpiatto; +Cc: 19620

> You have to recompile all the packages compiled with 24.4 when switching
> to 25.

No, you don't.  If you need that it's likely a bug, so don't do it
without first reporting the bug,


        Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el
  2015-01-17  4:56 bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el Kirill Ignatiev
  2015-01-17  5:43 ` Thierry Volpiatto
  2015-01-17  5:59 ` Kirill Ignatiev
@ 2015-01-17 14:43 ` Stefan Monnier
  2017-11-29  2:04   ` Noam Postavsky
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2015-01-17 14:43 UTC (permalink / raw
  To: Kirill Ignatiev; +Cc: 19620

> (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)





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el
  2015-01-17 14:43 ` Stefan Monnier
@ 2017-11-29  2:04   ` Noam Postavsky
  0 siblings, 0 replies; 6+ messages in thread
From: Noam Postavsky @ 2017-11-29  2:04 UTC (permalink / raw
  To: Stefan Monnier; +Cc: 19620, Kirill Ignatiev

tags 19620 fixed
close 19620 25.1
quit

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> (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.

Seems this was fixed in 25.1 then.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-29  2:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-17  4:56 bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el Kirill Ignatiev
2015-01-17  5:43 ` Thierry Volpiatto
2015-01-17 14:12   ` Stefan Monnier
2015-01-17  5:59 ` Kirill Ignatiev
2015-01-17 14:43 ` Stefan Monnier
2017-11-29  2:04   ` Noam Postavsky

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.