The problem of dynamic inheritance
cyberbaixing
cyberbaixing at yahoo.com.cn
Mon Jan 12 00:04:47 UTC 2004
Dear All,
I am a newer of SELF. I try to run the a program of dynamic
inheritance.
which is defined as follows:
globals _AddSlotsIfAbsent: (|
a =().
b =().
c =().
|)
a _Define: (|
f = ('a' printLine. p:b. f).
|)
b _Define: (|
f = ( 'b' printLine ).
|)
c _Define: (|
p*<- a.
b = b.
f = ('c' printLine. resend.f).
|)
But if I send the message f to slot a, the result is always:
"Self 14" a f.
a
No 'b' slot found in a slots object.
If I rewrite the slot a without the dynamic inheritance but replace
with directed resends or undirected resends like this:
a _Define: (|
p*<- b.
f = ('a' printLine. b. f).
|)
The result is:
"Self 14" a f.
a
b
'b'
Why the resends works but the dynamic inheritance not? Did I make any
semantic mistakes in slot a's definition?
Furthermore, how to understand the meaning of "activation record"?
In the above example, which one can be looked as the current
activation record? I know the slot a is the receiver of the message,
the method f has a clone. The code of f is running in the context of
clone. 'a'printLine prints out the string a, the code p:b.f is to
change the parent of slot a to slot b. But where is the activation
record here? Is it same as the activation object?
Thank you in advance.
Regards,
Xing
More information about the Self-interest
mailing list