[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28627: 24.5; doc of `copy-sequence'

From: Drew Adams
Subject: bug#28627: 24.5; doc of `copy-sequence'
Date: Wed, 27 Sep 2017 13:40:06 -0700 (PDT)

This (doc string) is not true for an empty sequence:

  "Return a copy of a list, vector, string or char-table."

This ((elisp) `Sequence Functions') is not true for an empty sequence:

     Storing a new element into the copy does not affect the original
     SEQUENCE, and vice versa.  However, the elements of the new
     sequence are not copies; they are identical (eq) to the elements
     of the original.  Therefore, changes made within these elements, as
     found via the copied sequence, are also visible in the original

This has not been true for an empty string since Emacs 23.  It is now
the case, for instance that (eq foo bar) here returns t:

(setq foo ""
      bar (copy-sequence foo))

(Before Emacs 23 it returned nil.)

Similarly, for [].  `copy-sequence' used to give you a new
empty-vector object.  Now it does not.

(However, before those changes the same thing did hold for the empty
list, (): copy-sequence did not return a new empty-list object.)

The doc should make clear that there is only one empty-sequence object,
for each type of sequence.  In particular, `copy-sequence' does not
create a new sequence object if the sequence is empty.

In GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=3D/c/usr --host=3Di686-pc-mingw32'

reply via email to

[Prev in Thread] Current Thread [Next in Thread]