Package = map from symbol name to symbol object. INTERN ~= (or (gethash ...) (setf (gethash ...))) UNINTERN ~= remhash
There's nothing special about symbols. You'd get the same effect with a map of constants and operations to add/remove them from the map.
On Fri, Jul 3, 2015 at 10:56 AM, Kenneth Tilton ken@tiltontec.com wrote:
On Fri, Jul 3, 2015 at 4:48 AM, Edi Weitz edi@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@tiltontec.com http://tiltontec.com @tiltonsalgebra
646-269-1077
"In a class by itself." *-Macworld*