[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#40671: [DOC] modify literal objects
From: |
Paul Eggert |
Subject: |
bug#40671: [DOC] modify literal objects |
Date: |
Fri, 24 Apr 2020 19:22:22 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
On 4/22/20 5:49 PM, Michael Heerdegen wrote:
> + 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.
>
> `eval' is used quite rarely. Can what you describe happen under other
> circumstances, or does it only happen to `eval'? E.g. what about this
> case for example:
>
> (let ((l (list 1 2 3)))
> (funcall (lambda () l)))
>
> Has the list become a constant?
No, because the list is not part of the expression that is being evaluated.
However, something like this could cause trouble:
(let ((l (list 'lambda '(x) '(setcdr l x))))
(eval (list l l)))
because it modifies the list l while it is evaluating it. (As it happens, this
code behaves differently in Emacs 26 than it does in Emacs 27 - that's what you
can get with undefined behavior....)
> Maybe I misread "might be executed" as
> "might be executed in the future" and you actually meant something like
> "might (currently) be executed (as part of the expression the
> interpreter currently executes).
>
> BTW, speaking about Lisp the term "evaluate" is probably preferable to
> "execute" I think.
Both good points. The word "executed" is already gone from the manual, and I
installed the attached patch to try to address the other point.
0001-Tweak-mutability-doc-a-bit-more.patch
Description: Text Data
- bug#40671: [DOC] modify literal objects, (continued)
- bug#40671: [DOC] modify literal objects, Drew Adams, 2020/04/28
- bug#40671: [DOC] modify literal objects, Paul Eggert, 2020/04/28
- bug#40671: [DOC] modify literal objects, Michael Heerdegen, 2020/04/28
- bug#40671: [DOC] modify literal objects, Paul Eggert, 2020/04/28
- bug#40671: [DOC] modify literal objects, Michael Heerdegen, 2020/04/29
- bug#40671: [DOC] modify literal objects, Eli Zaretskii, 2020/04/29
- bug#40671: [DOC] modify literal objects, Paul Eggert, 2020/04/29
- bug#40671: [DOC] modify literal objects, Drew Adams, 2020/04/24
- bug#40671: [DOC] modify literal objects, Richard Stallman, 2020/04/24
- bug#40671: [DOC] modify literal objects, Paul Eggert, 2020/04/25
- bug#40671: [DOC] modify literal objects,
Paul Eggert <=
- bug#40671: [DOC] modify literal objects, Andreas Schwab, 2020/04/25
- bug#40671: [DOC] modify literal objects, Paul Eggert, 2020/04/25
- bug#40671: [DOC] modify literal objects, Michael Heerdegen, 2020/04/28
- bug#40671: [DOC] modify literal objects, Michael Heerdegen, 2020/04/20
- bug#40671: [DOC] modify literal objects, Paul Eggert, 2020/04/20
- bug#40671: [DOC] modify literal objects, Drew Adams, 2020/04/20
- bug#40671: [DOC] modify literal objects, Paul Eggert, 2020/04/19
- bug#40671: [DOC] modify literal objects, Eli Zaretskii, 2020/04/20