all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pierre Lorenzon <devel@pollock-nageoire.net>
To: 20914@debbugs.gnu.org
Subject: bug#20914: eieio/slot/group
Date: Mon, 29 Jun 2015 19:29:52 +0200 (CEST)	[thread overview]
Message-ID: <20150629.192952.75170699401312078.devel@pollock-nageoire.net> (raw)
In-Reply-To: <20150629.063137.1610262414319480638.devel@pollock-nageoire.net>

[-- Attachment #1: Type: Text/Plain, Size: 262 bytes --]



OK I got it !

The problem comes from use of `copy-sequence' in
`eieio-copy-parents-into-subclass' function of eieio-core. this
copy is not reccursive as explained in code comment but it
should be ! There's a joined patch that fixes the bug.

Regards

Pierre


[-- Attachment #2: eieio-core-0629.patch --]
[-- Type: Text/X-Patch, Size: 1492 bytes --]

--- eieio-core..orig.el	2015-06-28 07:26:49.000000000 +0200
+++ eieio-core.el	2015-06-29 19:20:28.000000000 +0200
@@ -660,9 +660,32 @@
       (let ((pslots (eieio--class-slots pcv))
             (pinit (eieio--class-initarg-tuples pcv)))
         (dotimes (i (length pslots))
-	  (let* ((sd (cl--copy-slot-descriptor (aref pslots i)))
+	  ;;;  -- Props should be copied as well 
+	  ;;; PLN Mon Jun 29 17:25:54 2015
+	  ;;
+	  ;; Due to the way `cl--copy-slot-descriptor' acts
+	  ;; props in the copied object will not be a new
+	  ;; sequence but a reference to the parent
+	  ;; sequence. Hence when modifying this sequence
+	  ;; parent slot props will be altered as well : and it
+	  ;; SHOULD NOT !
+	  ;; 
+	  (let* ((pslot (aref pslots i))
+		 (sd (cl--copy-slot-descriptor pslot))
                  (init (car (rassq (cl--slot-descriptor-name sd) pinit))))
+	    ;;
+	    ;; Simply applying a `copy-sequence' on the props
+	    ;; will not work since props itself is a sequence
+	    ;; whose elements will not be copied and only
+	    ;; reference elements of the old props plist. A
+	    ;; reccursive copy should be performed.
+	    ;; 
+	    (setf (cl--slot-descriptor-props sd)
+		  (copy-tree
+		   (cl--slot-descriptor-props pslot)))
 	    (eieio--add-new-slot newc sd init nil nil sn))
+	  ;; 
+	  ;;;  -- End Props should be copied as well 
           )) ;; while/let
       ;; Now duplicate all the class alloc slots.
       (let ((pcslots (eieio--class-class-slots pcv)))

  reply	other threads:[~2015-06-29 17:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-28  6:02 bug#20914: eieio/slot/group Pierre Lorenzon
2015-06-29  4:31 ` Pierre Lorenzon
2015-06-29 17:29   ` Pierre Lorenzon [this message]
2015-06-30 18:09     ` Stefan Monnier
2015-07-01  4:02       ` Pierre Lorenzon
2015-07-01  6:35         ` Pierre Lorenzon
2015-07-01 13:31           ` Stefan Monnier

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=20150629.192952.75170699401312078.devel@pollock-nageoire.net \
    --to=devel@pollock-nageoire.net \
    --cc=20914@debbugs.gnu.org \
    /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.