GNU bug report logs - #7088
`copy-tree' of a vector copy sharing structure.with original

Previous Next

Package: emacs;

Reported by: MON KEY <monkey <at> sandpframing.com>

Date: Thu, 23 Sep 2010 05:27:02 UTC

Severity: normal

Done: Andreas Schwab <schwab <at> linux-m68k.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#7088: closed (`copy-tree' of a vector copy sharing
 structure.with original)
Date: Thu, 23 Sep 2010 08:46:03 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 23 Sep 2010 10:47:36 +0200
with message-id <m3bp7oonh3.fsf <at> hase.home>
and subject line Re: bug#7088: `copy-tree' of a vector copy sharing structure.with original
has caused the GNU bug report #7088,
regarding `copy-tree' of a vector copy sharing structure.with original
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
7088: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7088
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: MON KEY <monkey <at> sandpframing.com>
To: bug-gnu-emacs <at> gnu.org
Cc: 7083 <at> debbugs.gnu.org, Andreas Schwab <schwab <at> linux-m68k.org>
Subject: `copy-tree' of a vector copy sharing structure.with original
Date: Thu, 23 Sep 2010 01:28:33 -0400
When copy-tree copies vectors the copy shares structure with the original.

This is unlike the behavior of copy-tree on a list of lists:

(let ((orig '((a b) (c d) (e f) (g h)))
      new-cp)
  (setq new-cp (copy-tree orig))
  (equal (elt
          (prog1 orig
            (setf (car new-cp) "bubba")) 0)
         '(a b)))
;=> t

(let ((orig [[a b] [c d] [e f] [g h]])
      new-cp)
  (setq new-cp (copy-tree orig))
  (string-equal (aref (prog1 orig
                        (aset new-cp 0 "bubba"))
                      0)
                "bubba"))
;=> t

Shouldn't idx 0 of the orig tree still be [a b]?

Note This bug _should_ prob. have stayed with Bug7083 but that bug
report was prematurely closed.

--
/s_P\


[Message part 3 (message/rfc822, inline)]
From: Andreas Schwab <schwab <at> linux-m68k.org>
To: MON KEY <monkey <at> sandpframing.com>
Cc: 7083 <at> debbugs.gnu.org, 7088-done <at> debbugs.gnu.org
Subject: Re: bug#7088: `copy-tree' of a vector copy sharing structure.with
	original
Date: Thu, 23 Sep 2010 10:47:36 +0200
MON KEY <monkey <at> sandpframing.com> writes:

> When copy-tree copies vectors the copy shares structure with the original.

Works as documented.  A vector is not a cons cell.

If TREE is a cons cell, this recursively copies both its car and its cdr.
             ^^^^^^^^^

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


This bug report was last modified 14 years and 304 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.