Subject: bug#7088: closed (Re: bug#7088: `copy-tree' of a vector copy sharing structure.with original)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 23 Sep 2010 08:46:03 +0000

Your bug report

#7088: `copy-tree' of a vector copy sharing structure.with original

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
7088: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7088
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#7088: `copy-tree' of a vector copy sharing structure.with original
From: Andreas Schwab <[email-masked]>
To: MON KEY <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Thu, 23 Sep 2010 10:47:36 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

MON KEY <[email-masked]> 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, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

Subject: `copy-tree' of a vector copy sharing structure.with original
From: MON KEY <[email-masked]>
To: [email-masked]
Cc: [email-masked], Andreas Schwab <[email-masked]>
Date: Thu, 23 Sep 2010 01:28:33 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

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\