emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 ef35d40: Clarify subtle issues with 'eq' in byte-


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 ef35d40: Clarify subtle issues with 'eq' in byte-compiled code
Date: Fri, 8 Jun 2018 11:07:58 -0400 (EDT)

branch: emacs-26
commit ef35d405b1208a01f3e31b44247fedd058fa9b2f
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Clarify subtle issues with 'eq' in byte-compiled code
    
    * doc/lispref/objects.texi (Equality Predicates): Explain why
    byte-compiled code might compare literal objects with identical
    contents as 'eq'.  (Bug#31688)
---
 doc/lispref/objects.texi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index af74062..c7e751c 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -2144,6 +2144,21 @@ Symbols}.
      @result{} nil
 @end group
 @end example
+
address@hidden
address@hidden identical-contents objects, and byte-compiler
address@hidden objects with identical contents, and byte-compiler
+The Emacs Lisp byte compiler may collapse identical literal objects,
+such as literal strings, into references to the same object, with the
+effect that the byte-compiled code will compare such objects as
address@hidden, while the interpreted version of the same code will not.
+Therefore, your code should never rely on objects with the same
+literal contents being either @code{eq} or not @code{eq}, it should
+instead use functions that compare object contents such as
address@hidden, described below.  Similarly, your code should not modify
+literal objects (e.g., put text properties on literal strings), since
+doing that might affect other literal objects of the same contents, if
+the byte compiler collapses them.
 @end defun
 
 @defun equal object1 object2



reply via email to

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