Hi Tobias,
On Sun, May 16, 2010 at 11:51 AM, Tobias C. Rittweiler tcr@freebits.de wrote:
Alessio Stalla alessiostalla@gmail.com writes:
Why wrong? Literal coalescing is optional behaviour as far as I remember.
Literal coalescing is this: (cons '(1 2 3) '(1 2 3)) those two different '(1 2 3) constant objects can be coalesced to a single object at the discretion of the compiler (only in file compilation, iirc).
However, Erik talked about cases when the same literal object is present more than once in the source, like in:
(let ((foo '(1 2 3))) (compile nil `(lambda () (eq ',foo ',foo))))
Clearly, in the second case the equality of the constant object must be preserved.
Yes, that is true for COMPILE and EVAL.
Thanks for your response! I know the "object equality" rules for COMPILE and EVAL are more strict than they are for COMPILE-FILE. However, from my reading in http://www.lispworks.com/documentation/HyperSpec/Body/03_bdd.htm, first paragraph which says:
"If two literal objects appearing in the source code for a single file processed with the file compiler are the identical, the corresponding objects in the compiled code must also be the identical."
I thought that the case with the macro generating the same value twice in different locations of the source form, the exact same object needed to be reproduced in both locations. Do you read it differently? Or do you have a different section in the CLHS stating something else?
Thanks again!
Bye,
Erik.