emacs-devel
[Top][All Lists]
Advanced

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

Re: 31395511: "Don’t attempt to modify constant strings"


From: Paul Eggert
Subject: Re: 31395511: "Don’t attempt to modify constant strings"
Date: Fri, 5 Jun 2020 18:43:05 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

On 6/5/20 4:19 PM, João Távora wrote:
> I totally agree it is
> undefined behaviour to change structure of literals (quoted or
> self-evaluating objects), also in Common Lisp, because compilers are
> probably allowed to reuse parts of the internal structure of such
> objects.  But that's a far cry from having two different manifestations
> of `equal` such objects _be_ the same object, but only for compiled
> code.

I don't understand this remark, as the idea that "compilers are allowed to reuse
parts" necessarily implies that (eq "a" "a") can be t if the compiler decides to
reuse the string. Certainly in Common Lisp (eq "Foo" "Foo") might be true or
false (this specific example is called out in CLtL 6.3).

Anyway, Elisp has behaved compatibly with Common Lisp for some time, and it
works well in practice. I doubt whether it'd be a good idea to try to change
Elisp to require each string literal "unique", whatever that turns out to mean.



reply via email to

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