all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kirill Ignatiev <kirill.ignatiev@gmail.com>
Cc: 19620@debbugs.gnu.org
Subject: bug#19620: 25.0.50; Eieio constructor behaviour changed and broke pcache.el
Date: Sat, 17 Jan 2015 09:43:18 -0500	[thread overview]
Message-ID: <jwvk30lh4x9.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <CACe-pWzPL3_ZmXDhTuKkfL=usvWimdVRtn7C0cPH7_xUqRCcCQ@mail.gmail.com> (Kirill Ignatiev's message of "Fri, 16 Jan 2015 23:56:05 -0500")

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





  parent reply	other threads:[~2015-01-17 14:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2017-11-29  2:04   ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvk30lh4x9.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=19620@debbugs.gnu.org \
    --cc=kirill.ignatiev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.