GNU bug report logs - #64960
Documentation for copy-sequence

Previous Next

Package: emacs;

Reported by: uzibalqa <uzibalqa <at> proton.me>

Date: Sun, 30 Jul 2023 16:43:01 UTC

Severity: minor

Fixed in version 29.2

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>, uzibalqa <uzibalqa <at> proton.me>
Cc: Eli Zaretskii <eliz <at> gnu.org>, "64960 <at> debbugs.gnu.org" <64960 <at> debbugs.gnu.org>
Subject: bug#64960: Documentation for copy-sequence
Date: Mon, 31 Jul 2023 01:13:41 +0000
> > It is not evident what the meaning of "shared" means ?  If I use a
> > string, I get an exact copy and when I change a single character
> > the newlist is changed,  the original string remains the same.
> > So what is shared exactly ?
> 
> A string doesn't share anything because characters are not reference
> values. They are simply copied.

Yes and no.
Chars are not shared, but char properties are.

(setq foo (propertize "abcd" 'p1 t 'p2 42))
;; -> #("abcd" 0 4 (p2 42 p1 t))
(setq bar (copy-sequence foo))
;; -> #("abcd" 0 4 (p1 t p2 42))
(aset foo 1 ?W) ; -> ?W, aka 87
foo ; -> #("aWcd" 0 4 (p2 42 p1 t))
bar ; -> #("abcd" 0 4 (p1 t p2 42))

This bug report was last modified 1 year and 305 days ago.

Previous Next


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