No registered users in community xowiki
in last 10 minutes
in last 10 minutes
[Xotcl] Problem with per-object mixins?
From: Sheik Yussuff <sheik_at_carib-link.net>
Date: Wed, 5 Sep 2001 17:05:46 -0300
Consider the following program fragment:(Win 98 ver 0.85) where:
1. X has subclasses B and C
2. X has instproc m
3. object a mixes in {C B}
4. message p sent to object a(see code below)
The code produces as answer:
method p of A
method m
method m of A
I expected:
method p of A
method m
method m
method m of A
Apparently only the method m inherited by C is executed
while the method m inherited by B is not!!
Any help to clarify this situation is appreciated.
Thanks.
Regards,
--sheik
-----------------------------------------------------------------
# Code to illustrate above.
Class X
X instproc m args {
puts "method m"
next
}
Class A
A instproc m args {
puts "method m of A"
next
}
A instproc p args {
puts "method p of A"
[self] mixin {C B}
[self] m
}
Class B -superclass X
Class C -superclass X
A a
a p
Date: Wed, 5 Sep 2001 17:05:46 -0300
Consider the following program fragment:(Win 98 ver 0.85) where:
1. X has subclasses B and C
2. X has instproc m
3. object a mixes in {C B}
4. message p sent to object a(see code below)
The code produces as answer:
method p of A
method m
method m of A
I expected:
method p of A
method m
method m
method m of A
Apparently only the method m inherited by C is executed
while the method m inherited by B is not!!
Any help to clarify this situation is appreciated.
Thanks.
Regards,
--sheik
-----------------------------------------------------------------
# Code to illustrate above.
Class X
X instproc m args {
puts "method m"
next
}
Class A
A instproc m args {
puts "method m of A"
next
}
A instproc p args {
puts "method p of A"
[self] mixin {C B}
[self] m
}
Class B -superclass X
Class C -superclass X
A a
a p