Subject: Re: (eq x x) => false
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 26 Feb 2003 03:34:22 -0600
Newsgroups: comp.lang.lisp
Message-ID: <aMKcnTzCtp2DF8GjXTWc-g@speakeasy.net>
Ingvar Mattsson  <ingvar@cathouse.bofh.se> wrote:
+---------------
| (let ((x "Foo")
|       (y "Foo"))
|   (eq x y))
| 
| should be allowed to return either T or NIL, since the reader is free
| to collapse multiple read constant strings to the same string.
| 
| Of course, trying to provoke different returns in two random lisps
| (CMU CL and Clisp) managed to have CMUCL consistenly return T and
| clisp to consistently return nil.
+---------------

You think *that's* fun, then try the following, entirely within CMUCL:

	> (eq '(a . b) '(a . b))

	NIL
	> (progn
	    (eq '(a . b) '(a . b)))

	NIL
	> (let ()
	    (eq '(a . b) '(a . b)))

	T
	> (funcall (compile nil (lambda () (eq '(a . b) '(a . b)))))
	Compiling LAMBDA NIL: 
	Compiling Top-Level Form: 

	T
	> 

[My understanding is that the first two use the "mini-eval" built into
the top-level, while the third uses the byte-compiler, and the last, of
course, uses the full native-code compiler.]


-Rob

-----
Rob Warnock, PP-ASEL-IA		<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607