all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#7083: Why is `copy-tree's symbol-plist carrying side-effect-free error-free?
@ 2010-09-22  6:31 MON KEY
  2010-09-22 21:35 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: MON KEY @ 2010-09-22  6:31 UTC (permalink / raw)
  To: 7083

Why is `copy-tree' side-effect-free error-free?

(symbol-plist 'copy-tree)
=> (side-effect-free error-free)

It (potentially) `nconc's `nreverse's and `aset's the TREE arg recursively.

At revno: 45675 `copy-tree' was moved into subr.el from cl.el

,----
|
| committer: Colin Walters <walters@gnu.org>
| timestamp: Sat 2002-06-08 20:48:15 +0000
| message:
|   (copy-list): Moved here from cl.el.
|   (copy-tree): Renamed here from `cl-copy-tree' in cl.el.
|
`----

--
/s_P\





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

* bug#7083: Why is `copy-tree's symbol-plist carrying side-effect-free error-free?
  2010-09-22  6:31 bug#7083: Why is `copy-tree's symbol-plist carrying side-effect-free error-free? MON KEY
@ 2010-09-22 21:35 ` Andreas Schwab
  2010-09-23  5:23   ` MON KEY
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2010-09-22 21:35 UTC (permalink / raw)
  To: MON KEY; +Cc: 7083-done

MON KEY <monkey@sandpframing.com> writes:

> It (potentially) `nconc's `nreverse's and `aset's the TREE arg recursively.

Only the copy.

Andreas.

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





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

* bug#7083: Why is `copy-tree's symbol-plist carrying side-effect-free error-free?
  2010-09-22 21:35 ` Andreas Schwab
@ 2010-09-23  5:23   ` MON KEY
  2010-09-23 22:19     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: MON KEY @ 2010-09-23  5:23 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 7083

On Wed, Sep 22, 2010 at 5:35 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> MON KEY <monkey@sandpframing.com> writes:
>
>> It (potentially) `nconc's `nreverse's and `aset's the TREE arg recursively.
>
> Only the copy.
>

Only for the copy of a list.

Why has this bug been marked done?

When copy-tree copies vectors they share structure.

(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]?

If not, it should be documented that when copy-tree copies vectors the
"copy" will share structure just as with `copy-sequence'.

Regardless, simply marking the bug report as done with only a terse 3
word reply is obnoxious and not the least bit helpful for anyone else
referencing this report in the future, esp. as there does appear to be
a bug.


> Andreas.

--
/s_P\





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

* bug#7083: Why is `copy-tree's symbol-plist carrying side-effect-free error-free?
  2010-09-23  5:23   ` MON KEY
@ 2010-09-23 22:19     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-09-23 22:19 UTC (permalink / raw)
  To: MON KEY; +Cc: 7083, Andreas Schwab

> Why has this bug been marked done?
> When copy-tree copies vectors they share structure.

C-h f copy-tree RET documents the second (optional) argument which
affects this behavior.  So it looks perfectly correct, and documented.


        Stefan





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

end of thread, other threads:[~2010-09-23 22:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-22  6:31 bug#7083: Why is `copy-tree's symbol-plist carrying side-effect-free error-free? MON KEY
2010-09-22 21:35 ` Andreas Schwab
2010-09-23  5:23   ` MON KEY
2010-09-23 22:19     ` Stefan Monnier

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.