[Xotcl] Mixins in XOTcl

Adam Turoff aturoff at bna.com
Mon May 24 15:35:15 CEST 2004

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

More information about the Xotcl mailing list