No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] Issue with mixin delete
From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Mon, 08 May 2006 23:46:23 +0200
Scott Gargash schrieb:
>
> Is this documented somewhere? It surprised me.
>
in the source (joke).
>
>
> > PS: wouln't be conditional mixins a solution for your problem?
>
> I don't know. What do you mean by "conditional mixin"?
>
mixins with guards. see following example. -gustaf
Class Fly -instproc fly {} {puts "[my signature]: yippee, fly like an
eagle!"}
Class Sing -instproc sing {} {puts "[my signature]: what a difference
a day make"}
Class Animal -parameter age
Animal instproc unknown args { puts "[my signature]: how should i $args?"}
Animal instproc signature {} { return "[self] [my info class] ([my
age] years)" }
Class Bird -superclass Animal
Class Penguine -superclass Bird
Class Parrot -superclass Bird
Class Duck -superclass Bird
Parrot tweedy -age 1
Penguine pingo -age 5
Duck donald -age 4
Parrot lora -age 6
Bird instmixin {{Fly -guard {[my age]>2 && ![my istype Penguine]}} Sing}
foreach bird [Animal allinstances] { $bird fly }
> Scott
>
Date: Mon, 08 May 2006 23:46:23 +0200
Scott Gargash schrieb:
>
> Is this documented somewhere? It surprised me.
>
in the source (joke).
>
>
> > PS: wouln't be conditional mixins a solution for your problem?
>
> I don't know. What do you mean by "conditional mixin"?
>
mixins with guards. see following example. -gustaf
Class Fly -instproc fly {} {puts "[my signature]: yippee, fly like an
eagle!"}
Class Sing -instproc sing {} {puts "[my signature]: what a difference
a day make"}
Class Animal -parameter age
Animal instproc unknown args { puts "[my signature]: how should i $args?"}
Animal instproc signature {} { return "[self] [my info class] ([my
age] years)" }
Class Bird -superclass Animal
Class Penguine -superclass Bird
Class Parrot -superclass Bird
Class Duck -superclass Bird
Parrot tweedy -age 1
Penguine pingo -age 5
Duck donald -age 4
Parrot lora -age 6
Bird instmixin {{Fly -guard {[my age]>2 && ![my istype Penguine]}} Sing}
foreach bird [Animal allinstances] { $bird fly }
> Scott
>