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
On Wed, 5 Sep 2001, Sheik Yussuff wrote:
Consider the following program fragment:(Win 98 ver 0.85) where:
- X has subclasses B and C
- X has instproc m
- object a mixes in {C B}
- 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
I think your confusion is because class B and C both have the superclass X, you expect method 'm' to be passed twice to class X. This is apparently how C++ does it, and leads to substantial complexities in the language. XOTcl never goes to the same superclass twice in method calls (so if you increase an index in a super-class, you will be assured it wont be increased twice by mistake!). I think this is explained rather well in the XOTcl tutorial. At least it was when I read it through (a while back now..).
- ---------- = = ---------//--+ | / Kristoffer Lawson | www.fishpool.fi|.com +-> | setok@fishpool.com | - - --+------ |-- Fishpool Creations Ltd - / | +-------- = - - - = --------- /~setok/