[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

2 problems

    Date: Mon, 23 May 88 10:12:44 EDT
    From:     bds@mitre-bedford.ARPA

    We are running genera 7.2 on 3650's.  I've experienced the following 2

    1) Suppose I have the following:

    (defvar *a*)
    (defvar *b*)

    (defun eq-test ()
      (let ((a '(a b c d))
	     (b '(a b c d)))
	(setq *a* a)
	(setq *b* b)))

    After running eq-test, it turns out that *a* and *b* are eq!
    This, by the way, occurs with arrays, strings, etc.  The only
    way to avoid this is to make liberal use of copy-* in these

I presume you have compiled EQ-TEST?  The compiler is allowed to share
EQUAL constants and make them EQ.

    2) Suppose I have a structure named rts which is stored as a
    named vector.  Given an instance of this structure, rts-1,
    if I then do (setq rts-2 (copy-rts rts-1)), I find that although
    every slot of rts-2 is eq to the corresponding slot in rts-1,
    rts-1 and rts-2 are not equal !  

Of course all the elements are EQ, you copied pointers to all of them
from the old structure into the new one.  And of course RTS-1 and RTS-2
are not EQ, because RTS-2 is brand new.

    Moreover, given that the nominal-equipment-list slot of rts is a list
    of equipment structures, I find that

    (eq (rts-nominal-equipment-list rts-1)
	(rts-nominal-equipment-list rts-2))

    returns t, but when I do 

    (push t (rts-nominal-equipment-list rts-1))

    rts-1 is modified but rts-2 is not!

Of course.  The slot in RTS-2 still points to the original head of the
list, but the slot in RTS-1 now points to the new head of the list (the
one with T in it).

    Thanks for your help.

    Barry Smith