GNU bug report logs - #40671
[DOC] modify literal objects

Previous Next

Package: emacs;

Reported by: Kevin Vigouroux <ke.vigouroux <at> laposte.net>

Date: Thu, 16 Apr 2020 20:40:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#40671: closed ([DOC] modify literal objects)
Date: Sat, 18 Apr 2020 20:11:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 18 Apr 2020 13:10:30 -0700
with message-id <d999d009-1a19-88f7-fe1e-2b9eb287be33 <at> cs.ucla.edu>
and subject line Re: [DOC] modify literal objects
has caused the debbugs.gnu.org bug report #40671,
regarding [DOC] modify literal objects
to be marked as done.

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


-- 
40671: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=40671
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Kevin Vigouroux <ke.vigouroux <at> laposte.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [DOC] modify literal objects
Date: Thu, 16 Apr 2020 21:28:03 +0200
Hello!

The Emacs Lisp manual often gives the impression that the user can
modify literal lists (e.g. 5.6.1 Altering List Elements with `setcar`).

LISP> (setq x '(1 2))
(1 2)
LISP> (setcar x 4)
LISP> x
(4 2)

However, it is also mentioned that one should not modify the literal
objects because of the byte compilation (c.f. 2.7 Equality Predicate).

Can we modify literal objects?

See Also:

https://emacs.stackexchange.com/questions/45820/when-to-use-quote-for-lists-modifying-quoted-lists-in-elisp
https://emacs.stackexchange.com/questions/57806/which-lisp-objects-are-byte-compiled

Best regards,
Kevin Vigouroux.


[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Mattias EngdegÄrd <mattiase <at> acm.org>
Cc: Kevin Vigouroux <ke.vigouroux <at> laposte.net>, Eli Zaretskii <eliz <at> gnu.org>,
 40671-done <at> debbugs.gnu.org
Subject: Re: [DOC] modify literal objects
Date: Sat, 18 Apr 2020 13:10:30 -0700
[Message part 4 (text/plain, inline)]
Mattias, thanks for going through the Emacs manual and looking for mistakes in 
this area. I know it was a pain to do that, since I did something similar in 
parallel and it was painful for me. I used your patch to crosscheck with my 
draft (finding omissions on both sides) and installed the resulting patch 
(attached) into the emacs-27 branch.

This patch should address the points that Eli raised. That is, it adds 
explanations of the issue (both in the intro and the reference manual, since the 
issue also infects the intro), and it attempts to change examples only when the 
changes are needed to avoid undefined behavior in Emacs Lisp. I also kept the 
changes from '< to #'< that were in your patch since that's good style.
[0001-Document-constant-vs-mutable-objects-better.patch (text/x-patch, attachment)]

This bug report was last modified 5 years and 3 days ago.

Previous Next


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