bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#31688: 26.1.50; Byte compiler confuses two string variables


From: Phil Sainty
Subject: bug#31688: 26.1.50; Byte compiler confuses two string variables
Date: Sun, 03 Jun 2018 11:38:44 +1200
User-agent: Orcon Webmail

On 2018-06-03 06:02, Noam Postavsky wrote:
I don't think this is a bug, the compiler coalesces equal string
literals.

Ouch.  Has this always been the case?  I've been firmly under the
impression that the lisp reader creates a new lisp objects whenever
it reads a string, so it's hugely surprising to me to learn that
(eq str1 str2) can return different results depending on whether
or not the code was byte-compiled.

I see that this is t when compiled and nil otherwise:

(let ((str1 "abc")
      (str2 "abc"))
  (eq str1 str2)))

But this is nil regardless:

(eq "abc" "abc")

This seems kinda horrible?

-Phil






reply via email to

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