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: Paul Eggert <eggert <at> cs.ucla.edu>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Mattias EngdegÄrd <mattiase <at> acm.org>, 40671 <at> debbugs.gnu.org, ke.vigouroux <at> laposte.net
Subject: bug#40671: [DOC] modify literal objects
Date: Tue, 21 Apr 2020 23:30:37 -0700
On 4/19/20 8:36 PM, Michael Heerdegen wrote:
> Paul Eggert <eggert <at> cs.ucla.edu> writes:
> 
>> +  A mutable object can become constant if it is passed to the
>> +@code{eval} function, because you should not modify an object that is
>> +being or might be executed.  The reverse does not occur: constant
>> +objects should stay constant.
>> +
> 
> I don't know if what you say about the interpreter is true (I hope it is
> not),

Unfortunately it is true, for performance reasons: you can't reliably change a 
form that is currently being executed by the Lisp interpreter. This is because 
the interpreter can cache parts of such forms, or can check forms and later 
execute them under the assumption that the checks succeeded, and if the caches 
are invalid or the earlier checks no longer apply then Emacs can dump core or worse.

> "you should not modify an
> object that is being or might be executed" - isn't that quite common
> when calculating macro expansions (which, typically, are executed)?

You can modify the object before giving it to 'eval' (and macro expansion can do 
modifications like that), but you shouldn't modify it while it's being evaluated.




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.