Do symbols need to be EQ?
Kenneth Tilton
ken at tiltontec.com
Fri Jul 3 08:56:48 UTC 2015
On Fri, Jul 3, 2015 at 4:48 AM, Edi Weitz <edi at weitz.de> wrote:
> Perhaps the excerpt below (from a fresh LW image) makes more obvious
> what my "philosophical problem" is. I have redacted the output of
> DISASSEMBLE to only show the relevant parts. It shows that EQ is
> essentially just one simple comparison with a machine word (which is
> what I expected). It also shows that I get the same machine word
> again as long as I don't mess around with UINTERN or something. But
> once I've done that, I get _another_ machine word and so in terms of
> simple-minded EQ I get a different object.
>
> CL-USER 1 > (defun foo-1 (x)
> (eq x 'bar))
> FOO-1
> CL-USER 2 > (disassemble 'foo-1)
> ;; ...
> 21: 3DF771F921 cmp eax, 21F971F7 ; BAR
> 26: 750D jne L3
> ;; ...
> NIL
> CL-USER 3 > (defun foo-2 (x)
> (eq x 'bar))
> FOO-2
> CL-USER 4 > (disassemble 'foo-2)
> ;; ...
> 21: 3DF771F921 cmp eax, 21F971F7 ; BAR
> 26: 750D jne L3
> ;; ...
> NIL
> CL-USER 5 > (unintern 'bar)
> T
> CL-USER 6 > (defun foo-3 (x)
> (eq x 'bar))
> FOO-3
> CL-USER 7 > (disassemble 'foo-3)
> ;; ...
> 21: 3DAB71F921 cmp eax, 21F971AB ; BAR
> 26: 750D jne L3
> ;; ...
> NIL
>
>
Sorry, where is the problem? The spec is clear that a new object (with a
new pointer) will be created given the unintern hijinx, so all is
consistent: different pointer, EQ->nil.
ie, It is not just "in terms of EQ" that you have a different object: you
have created two distinct pointer objects (and EQ dutifully says so).
And at a higher level of abstraction, you have created two different
symbols, one interned and one not.
-kt
--
Kenneth Tilton
54 Isle of Venice Dr
Fort Lauderdale, FL 33301
ken at tiltontec.com
http://tiltontec.com
@tiltonsalgebra
646-269-1077
"In a class by itself." *-Macworld*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20150703/d9ff0b0d/attachment-0001.html>
More information about the pro
mailing list