View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] Mixins in XOTcl

From: Adam Turoff <aturoff_at_bna.com>
Date: Mon, 24 May 2004 09:35:15 -0400

Uwe Zdun wrote:
> what about just extending the usually interfaces with new
> arguments, such as:
>
> A mixin X
> A mixin add Z 3
> A mixin add Y end
> A mixin delete Y
> A instmixin add T 1
> A superclass B
> A superclass add C

That's pretty much what I was thinking:

    A mixin X ;# current behavior
    A mixin -set X ;# A mixin X
    A mixin -set X Y Z ;# A mixin {X Y Z}

    A mixin -add X ;# A mixinappend X

Using -set, -add and -delete feels more Tcl-ish. Also, it
is somewhat bad style to name a class 'add', but even worse
style to name it '-add'. By using options, I can still
mixin a class 'add' into a definition. Preventing me from
mixing in a class '-add' is a good idea, for other reasons.

-- Adam