A compiled program and a source code can be interpreted differently at runtime. The issue is that some Lisp objects should not be modified because of the byte-compilation.
Emacs Lisp manual: 2.7 Equality Predicates
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
eq
, while the interpreted version of the same code will not. Therefore, your code should never rely on objects with the same literal contents being eithereq
or noteq
, it should instead use functions that compare object contents such asequal
, 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.
This does not imply that all Lisp objects are necessarily byte-compiled but the byte-compilation can change the code somehow.
Emacs Lisp manual: 17 Byte Compilation
Emacs Lisp has a "compiler" that translates functions written in Lisp into a special representation called "byte-code" that can be executed more efficiently. The compiler replaces Lisp function definitions with byte-code. When a byte-code function is called, its definition is evaluated by the "byte-code interpreter".
I think that the compiled code is read only once but may be evaluated several times.
In addition, in general, there are not only primitive objects. In the broader sense, which Lisp objects are byte-compiled? For example, are literal objects all and always byte-compiled?
Let's end with two final observations. 1. The Elisp manual shows that we can modify literal lists bound to variables. 2. Previously, lambda expressions had to be specified as functions '#(lambda ...)
in order to be byte-compiled.
Note: From my point of view, a "byte-compiled object" can be a special object created because of the byte-compilation (e.g. a byte-compiled function) or any object that appears only during the byte-compilation (e.g. a constant object).
propertize
returns a copy. But, setting a variable to a literal string and then callingput-text-property
with that variable as optional argOBJECT
should be avoided. -- Good to know.M-x report-emacs-bug
or email to[email protected]