[Prev][Next][Index][Thread]
Re: Need help with Class-Allocated Slots
In article <20000627234232.8986.qmail@gorn.americom.com>,
rwk@americom.com wrote:
> There could (ought to) be a way to qualify the ambiguous reference to
> make it clear which reference is being requested, "method foo" of "slot
> foo".
No. In Dylan there is no difference between "method foo" and "slot
foo". *All* slots are conceptually used via accessor methods, all the
time. The compiler creates default accessor methods for slots which
read/write memory at the appropriate offset for objects of that class.
Different classes might have the same slot at different offsets, because
of multiple inheritance. This is handled using Generic Function
dispatch to select the correct accessor method for a particular object.
If the exact object type is known then the correct method is called
directly, or (more usually) inlined into a simple memory reference.
The programmer can override the accessor methods for a slot to do
something different. You can even have slots with no storage at all
("virtual slots").
-- Bruce
References: