[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- To: COMMONLOOPS.PA@Xerox.COM
- From: primerd!MMODEL@S66.Prime.PDN.ARPA
- Date: 29 Jun 87 18:36:45 EDT
To: (CommonLoops.pa@Xerox.COM)
From: Mitchell Model (MModel@S66)
Subject: with-slots and local variables
This is a repeat of a message sent a week ago -- since I haven't
received it from the mailing list, I suspect it didn't get through.
I apologize if this is actually a duplicate.
There is an inconsistency in the way WITH-SLOTS handles symbols
that are both locally bound and instance variable names. Suppose
flavor ONE has a slot called NAME. Then, in the expansion of:
(WITH-SLOTS ((SELF :CLASS ONE))
(LET ((NAME 'FIRST))
(SETQ NAME 'SECOND)
(PRINT NAME)))
the SETQ expression is replaced by the machinery to set the IV's
value to 'SECOND, but NAME is left untouched in the PRINT statement.
Yes, it is better not to use an IV name as a local variable name, but
with lots of mixins flying around, and deep inheritance hierarchies,
a user of a class may not always realized what all the names are or
may be careless or may forget, etc.
The fix is a single change to EXPAND-WITH-SLOTS: wrap
(AND (NULL (VARIABLE-LEXICAL-P (CADR FORM)))
(NULL (VARIABLE-SPECIAL-P (CADR FORM)))
...)
around the SETQ that begins the second clause of the COND that handles
SETQ/SETF forms, so that that clause is not invoked if the variable
being set is bound locally or is special.
--- Mitchell Model