[Xotcl] Problem with per-object mixins?
Kristoffer Lawson
setok@fishpool.com
Wed, 5 Sep 2001 23:48:56 +0300 (EEST)
On Wed, 5 Sep 2001, Sheik Yussuff wrote:
> 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
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/