[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#31688: 26.1.50; Byte compiler confuses two string variables
From: |
Drew Adams |
Subject: |
bug#31688: 26.1.50; Byte compiler confuses two string variables |
Date: |
Sat, 2 Jun 2018 23:03:52 +0000 (UTC) |
> I don't think this is a bug, the compiler coalesces equal string
> literals. `put-text-property' modifies the string destructively, so you
> shouldn't use it on literals, for the same reason you shouldn't use
> destructive operations on quoted list literals. Another example, not
> dependent on compilation:
>
> (defun foo (prop val)
> (let ((s "xyz"))
> (put-text-property 0 3 prop val s)
> s))
>
> (foo 'x 1) ;=> #("xyz" 0 3 (x 1))
> (foo 'y 2) ;=> #("xyz" 0 3 (x 1 y 2))
Yes. See also this, about Common Lisp:
https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node74.html
A snippet of it:
An additional problem with eq is that the implementation
is permitted to ``collapse'' constants (or portions thereof)
appearing in code to be compiled if they are equal. An object
is considered to be a constant in code to be compiled if it
is a self-evaluating form or is contained in a quote form.
This is why (eq "Foo" "Foo") might be true or false; in
interpreted code it would normally be false, because reading
in the form (eq "Foo" "Foo") would construct distinct strings
for the two arguments to eq, but the compiler might choose to
use the same identical string or two distinct copies as the
two arguments in the call to eq.
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Gemini Lasswell, 2018/06/02
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Noam Postavsky, 2018/06/02
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Gemini Lasswell, 2018/06/02
- bug#31688: 26.1.50; Byte compiler confuses two string variables,
Drew Adams <=
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Phil Sainty, 2018/06/02
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Noam Postavsky, 2018/06/02
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Phil Sainty, 2018/06/03
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Andreas Schwab, 2018/06/03
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Phil Sainty, 2018/06/04
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Eli Zaretskii, 2018/06/04
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Andreas Schwab, 2018/06/04
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Eli Zaretskii, 2018/06/08
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Michael Heerdegen, 2018/06/02
- bug#31688: 26.1.50; Byte compiler confuses two string variables, Drew Adams, 2018/06/02