[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Keyword problem in PCL
- To: Ed Krall <krall%pp.mcc.com%pp.mcc.com@MCC.COM>
- Subject: Re: Keyword problem in PCL
- From: kanderso@VAX.BBN.COM
- Date: 20 May 87 11:37:58 EDT (Wed)
- Cc: commonloops.pa@Xerox.COM, kanderso@VAX.BBN.COM
- In-reply-to: Your message of Fri, 15 May 87 08:20 CDT. <8705151321.AA10737@pp.mcc.com>
Posted-Date: Friday, 15 May 1987, 08:20-CDT
Date: Fri, 15 May 87 08:20 CDT
From: Ed Krall <krall%pp.mcc.com%pp.mcc.com@MCC.COM>
MMDF-Warning: Parse error in original version of preceding line at VAX.BBN.COM
Subject: Keyword problem in PCL
Perhaps I am missing something, but the following behavior is a bit of a
Class AAA has an instance variable or slot called "name". Therefore
subclass AA of AAA also has this slot. When I do a
(make-instance 'AA :name "joe"),
the slot that gets initialized is the one named pcl::name not user::name.
Why is this? Because
1. the keyword lookup procedure (referenced from
initialize-from-init-plist in the file slots.lsp) does a simple
forward search on the value returned by class-instance-slots, and
2. this value lists the instance slots in ancestral order, and
3. the slots pcl::name and user::name have the same keyword, :name.
I wonder if this is the optimal behavior. Shouldn't the more recent or
local declaration (user::name) shadow the older and more general one
The problem is that the decision to use keywords to initialize
variables (in flavors and PCL) collapses the symbol namespace as
described above. In the original Flavors documentation, this was
considered a good thing because messages were generic operations, and
you shouldn't have to remember what package every message is in.
In the more recent view of object oriented programming as described in
CLOS, i'm not so sure using keywords is still so good an idea.
In Symbolics General 7 Flavors, at least you are warned of the symbol
name clash, and this should happen in PCL too. Whenever i get such a
warning, i rename one of the slots.