[Top][All Lists]

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

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

From: João Távora
Subject: Re: 31395511: "Don’t attempt to modify constant strings"
Date: Sat, 6 Jun 2020 12:41:18 +0100

On Sat, Jun 6, 2020 at 2:43 AM Paul Eggert <eggert@cs.ucla.edu> wrote:
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.

Depending on the implementation of sequences, it could reuse only the
later parts of the sequences to maintain uniqueness and still have
Certainly in Common Lisp (eq "Foo" "Foo") might be true or
false (this specific example is called out in CLtL 6.3).

I stand corrected.  I was simply mistaken :-)


reply via email to

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