GNU bug report logs -
#40671
[DOC] modify literal objects
Previous Next
Full log
View this message in rfc822 format
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.