Index: doc/example-scripts/ruby-mixins.tcl =================================================================== diff -u -r45e24b34c85bf0fc3e14db5250550100bd07ff31 -r12319faaf20df7116346558bd948b0edda9124eb --- doc/example-scripts/ruby-mixins.tcl (.../ruby-mixins.tcl) (revision 45e24b34c85bf0fc3e14db5250550100bd07ff31) +++ doc/example-scripts/ruby-mixins.tcl (.../ruby-mixins.tcl) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -124,14 +124,14 @@ # the precedence list. A decorator is able to modify the behavior of # all of the methods of the class, where it is mixed into. -? {g1 object mixin Mix} "::Mix" +? {g1 object mixin set Mix} "::Mix" ? {g1 info precedence} "::Mix ::Group ::Enumerable ::nx::Object" ? {g1 count} {alpha 3 omega} # For the time being, remove the mixin class again. -? {g1 object mixin ""} "" +? {g1 object mixin set ""} "" ? {g1 info precedence} "::Group ::Enumerable ::nx::Object" # @@ -213,7 +213,7 @@ # and decorates the instances of +ATeam+ as well the instances of its # specializations (like e.g. +SpecialForce+). -? {ATeam mixin Mix} "::Mix" +? {ATeam mixin set Mix} "::Mix" ? {s1 info precedence} "::Mix ::SpecialForce ::ATeam ::Enumerable ::nx::Object" Index: library/nx/nx.tcl =================================================================== diff -u -r85ee1fdb043ed3f82fd272cc004c476c40861fdb -r12319faaf20df7116346558bd948b0edda9124eb --- library/nx/nx.tcl (.../nx.tcl) (revision 85ee1fdb043ed3f82fd272cc004c476c40861fdb) +++ library/nx/nx.tcl (.../nx.tcl) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -1025,7 +1025,6 @@ } elseif {$property eq "optional"} { lappend opts -required 0 } elseif {$property in [list "alias" "forward" "cmd" "initcmd"]} { - set class [:requireClass ::nx::ObjectParameterSlot $class] lappend opts -disposition $property set class [:requireClass ::nx::ObjectParameterSlot $class] } elseif {[regexp {([01])[.][.]([1n*])} $property _ minOccurance maxOccurance]} { @@ -1335,9 +1334,9 @@ set d [nsf::directdispatch ${:domain} \ ::nsf::classes::nx::Object::__resolve_method_path \ {*}[expr {${:per-object} ? "-per-object" : ""}] ${:settername}] - :createForwarder [dict get $d methodName] [dict get $d object] + :createForwarder [dict get $d methodName] [dict get $d object] } else { - :createForwarder ${:name} ${:domain} + :createForwarder ${:name} ${:domain} } } @@ -1353,7 +1352,11 @@ lappend options ${:elementtype} #puts stderr "+++ [self] added elementtype ${:elementtype}" } - lappend options ${:disposition} + if {${:disposition} eq "slotassign"} { + lappend options slot=[::nsf::self] ${:disposition} method=${:forwardername} + } else { + lappend options ${:disposition} + } if {${:name} ne ${:methodname}} {lappend options method=${:methodname}} if {${:required}} { lappend options required @@ -1414,6 +1417,8 @@ set :parameterSpec [list [:namedParameterSpec $prefix ${:name} $options]] } } + + #puts stderr ================${:parameterSpec} return ${:parameterSpec} } @@ -1496,6 +1501,7 @@ # create methods for slot operations assign/get/add/delete # ::nsf::method::alias RelationSlot assign ::nsf::relation + ::nsf::method::alias RelationSlot set ::nsf::relation ::nsf::method::alias RelationSlot get ::nsf::relation RelationSlot protected method delete_value {obj prop old value} { @@ -1590,18 +1596,49 @@ # mixin # filter - ::nx::RelationSlot create ::nx::Object::slot::object-mixin \ - -multiplicity 0..n \ - -methodname "::nx::Object::slot::__object::mixin" \ - -settername "object mixin" -forwardername object-mixin -elementtype mixinreg + if {0} { + ::nx::RelationSlot create ::nx::Object::slot::object-mixin \ + -multiplicity 0..n \ + -methodname "::nx::Object::slot::__object::mixin" \ + -settername "object mixin" -forwardername object-mixin -elementtype mixinreg + } + if {1} { + ::nx::RelationSlot create ::nx::Object::slot::object-mixin \ + -multiplicity 0..n \ + -defaultmethods get \ + -disposition slotassign \ + -settername "object mixin" -forwardername object-mixin -elementtype mixinreg + } ::nx::RelationSlot create ::nx::Object::slot::object-filter \ -methodname "::nx::Object::slot::__object::filter" \ -multiplicity 0..n \ -settername "object filter" -forwardername object-filter -elementtype filterreg - - ::nx::RelationSlot create ::nx::Class::slot::mixin \ - -multiplicity 0..n \ - -forwardername class-mixin -elementtype mixinreg + if {0} { + #puts stderr =============1 + ::nx::RelationSlot create ::nx::Class::slot::mixin \ + -multiplicity 0..n \ + -methodname "mixin set" \ + -defaultmethods {get} \ + -forwardername "class-mixin" -elementtype mixinreg + } + if {0} { + #puts stderr =============2 + ::nx::RelationSlot create ::nx::Class::slot::mixin \ + -multiplicity 0..n \ + -methodname "::nx::Class::slot::mixin set %self class-mixin" \ + -disposition forward \ + -forwardername "class-mixin" -elementtype mixinreg + } + if {1} { + #puts stderr =============3 + ::nx::RelationSlot create ::nx::Class::slot::mixin \ + -multiplicity 0..n \ + -methodname "mixin" \ + -defaultmethods get \ + -disposition slotassign \ + -forwardername "class-mixin" -elementtype mixinreg + #puts stderr =============4 + } ::nx::RelationSlot create ::nx::Class::slot::filter \ -multiplicity 0..n \ -forwardername class-filter -elementtype filterreg Index: tests/class-method.test =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -r12319faaf20df7116346558bd948b0edda9124eb --- tests/class-method.test (.../class-method.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ tests/class-method.test (.../class-method.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -10,8 +10,8 @@ ? {::C public class method foo {} {return foo}} "'class' is not a method defining method" :public object method f args {next} } - ? {::C class mixin M1} \ - "method 'class' unknown for ::C; consider '::C create class mixin M1' instead of '::C class mixin M1'" + ? {::C class mixin set M1} \ + "method 'class' unknown for ::C; consider '::C create class mixin set M1' instead of '::C class mixin set M1'" ? {::C class filter f} \ "method 'class' unknown for ::C; consider '::C create class filter f' instead of '::C class filter f'" @@ -64,9 +64,9 @@ ? {::C a} "pm1" ? {::C fwd} "pm1" - ? {::C class mixin M1} ::M1 + ? {::C class mixin set M1} ::M1 ? {::C class info mixin classes} ::M1 - ? {::C class mixin ""} "" + ? {::C class mixin set ""} "" ? {::C class info mixin classes} "" ? {::C class filter f} f Index: tests/destroy.test =================================================================== diff -u -r85ee1fdb043ed3f82fd272cc004c476c40861fdb -r12319faaf20df7116346558bd948b0edda9124eb --- tests/destroy.test (.../destroy.test) (revision 85ee1fdb043ed3f82fd272cc004c476c40861fdb) +++ tests/destroy.test (.../destroy.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -701,7 +701,7 @@ ::nx::Object public method f1 args {next} ::nx::Object public method f2 args {next} - ::nx::Object filter {f1 f2} + ::nx::Object filter set {f1 f2} set x [nx::Class new { :volatile @@ -720,7 +720,7 @@ ? [list info command $x] $x "destroy via volatile method + 2 filters" - ::nx::Object filter "" + ::nx::Object filter set "" } nx::test case nested-ordered-composite { Index: tests/disposition.test =================================================================== diff -u -r85ee1fdb043ed3f82fd272cc004c476c40861fdb -r12319faaf20df7116346558bd948b0edda9124eb --- tests/disposition.test (.../disposition.test) (revision 85ee1fdb043ed3f82fd272cc004c476c40861fdb) +++ tests/disposition.test (.../disposition.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -303,7 +303,7 @@ # The option 'method=...' applies to disposition types only # C setObjectParams [list [list -foo:initcmd,method=BOOM]] - ? {C new} "parameter option 'method=' only allowed for parameter types 'alias' and 'forward'" + ? {C new} "parameter option 'method=' only allowed for parameter types 'alias', 'forward' and 'slotassign'" C setObjectParams [list [list -foo:alias,forward]] ? {C new} "parameter option 'forward' not valid in this option combination" @@ -587,7 +587,7 @@ # effective difference between #activelevel and #callinglevel, both # skip INACTIVE frames. - Callee mixin [Class new {:public method call args { next }}] + Callee mixin set [Class new {:public method call args { next }}] foreach dispoSpec { {-ah:alias,method=call {call:alias X}} @@ -955,7 +955,7 @@ } } - C mixin M1 + C mixin set M1 # N+4 |:CscFrame @Type(ENSEMBLE) | <-- foo (leaf) # N+3 |:CscFrame @Call(ENSEMBLE) | <-- FOO (root) @@ -981,7 +981,7 @@ } "::c2--FOO foo--foo" # ... the filter variant ... - C mixin {} + C mixin set {} C public method intercept args { next } @@ -1027,7 +1027,7 @@ } } - C::slot::__FOO object mixin M2 + C::slot::__FOO object mixin set M2 ? {C::slot::__FOO foo} "::M2--::C::slot::__FOO--foo--foo" C::slot::__FOO eval {unset :msg} @@ -1037,7 +1037,7 @@ c1 eval {set :msg} } "::c1--FOO foo--foo" - C::slot::__FOO object mixin {} + C::slot::__FOO object mixin set {} C::slot::__FOO public object method intercept {} { return "[current]--[next]" } @@ -1062,7 +1062,7 @@ } } - C mixin M2 + C mixin set M2 # N+4 |:CscFrame @Type(ENSEMBLE) | <-- C.FOO.foo (leaf) # N+2 |:CscFrame @Call(ENSEMBLE) | <-- C.FOO (root) @@ -1077,7 +1077,7 @@ c1 eval {set :msg} } "(1)--::c1--FOO foo--foo--(3)--::M2--FOO foo--::c1" - C mixin {} + C mixin set {} } nx::test case dispo-configure-transparency { @@ -1124,7 +1124,7 @@ C setObjectParams [list [list FOO:alias,noarg ""]] C mixin add M ? {C create c} "::c-FOO" - C mixin {} + C mixin set {} # ... at the called object level @@ -1212,7 +1212,7 @@ } - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler ? {[T create t] z uff} "CURRENT-::obj-DELEGATOR-::t-UNKNOWNMETHOD-uff-PATH-z" \ "Aliased dispatch to unknown method (custom unknown handler)" set x [UnknownHandler create handledObj] @@ -1229,11 +1229,11 @@ # # a) direct dispatch (non-aliased) with fully qualified selector (::*) # - ::obj object mixin {} + ::obj object mixin set {} T setObjectParams x:alias,method=::obj ? {T create t XXX} "::t: unable to dispatch method '::obj'" "FQ dispatch with default unknown handler" - ::T mixin UnknownHandler + ::T mixin set UnknownHandler ? {T create t XXX} "UNKNOWNMETHOD-::obj" "FQ dispatch with custom unknown handler" # @@ -1242,7 +1242,7 @@ UnknownHandler method defaultmethod {} { set :defaultmethod 1 } - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler T setObjectParams [list [list z:alias,noarg ""]] ? {T create t; ::obj eval {info exists :defaultmethod}} 1 \ "Calling defaultmethod via alias+noarg combo with empty default" @@ -1262,29 +1262,29 @@ # ? {T create t XXX} "invalid argument 'XXX', maybe too many arguments; should be \"::t configure ?/z/?\"" - ::obj object mixin {} + ::obj object mixin set {} T setObjectParams [list z:alias] ? {T create tt YYY} "::obj: unable to dispatch method 'YYY'" "sending the msg: tt->z(::obj)->YYY()" - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler ? {T create tt YYY} "CURRENT-::obj-DELEGATOR-::tt-UNKNOWNMETHOD-YYY-PATH-z" \ "sending the msg: tt->z(::obj)->YYY()" - ::obj object mixin {} + ::obj object mixin set {} T setObjectParams [list -z:alias] ? {T create tt -z YYY} "::obj: unable to dispatch method 'YYY'" "sending the msg: tt->z(::obj)->YYY()" - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler ? {T create tt -z YYY} "CURRENT-::obj-DELEGATOR-::tt-UNKNOWNMETHOD-YYY-PATH-z" \ "sending the msg: tt->z(::obj)->YYY()" # # [current methodpath] & empty selector strings: # - ::obj object mixin {} + ::obj object mixin set {} T setObjectParams [list z:alias] ? {T create tt ""} "::obj: unable to dispatch method ''" "sending the msg: tt->z->{}()" - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler ? {T create tt ""} "CURRENT-::obj-DELEGATOR-::tt-UNKNOWNMETHOD--PATH-z" "sending the msg: tt->z->{}()" T setObjectParams [list -z:alias] ? {T create tt -z ""} "CURRENT-::obj-DELEGATOR-::tt-UNKNOWNMETHOD--PATH-z" "sending the msg: tt->z()" @@ -1293,15 +1293,15 @@ # # Dispatch with a method handle # - ::T mixin {} + ::T mixin set {} #puts stderr =================1 ? [list [T create t] $methods(z) XXX] \ "CURRENT-::obj-DELEGATOR-::t-UNKNOWNMETHOD-XXX-PATH-::nsf::classes::T::z" #puts stderr =================3 T setObjectParams x:alias,method=$methods(z) ? {T create t XXX} "CURRENT-::obj-DELEGATOR-::t-UNKNOWNMETHOD-XXX-PATH-::nsf::classes::T::z" \ "Non-object FQ selector with default unknown handler" - ::T mixin UnknownHandler + ::T mixin set UnknownHandler ? {T create t XXX} "CURRENT-::obj-DELEGATOR-::t-UNKNOWNMETHOD-XXX-PATH-::nsf::classes::T::z" \ "Non-object FQ selector with custom unknown handler" Index: tests/info-method.test =================================================================== diff -u -r85ee1fdb043ed3f82fd272cc004c476c40861fdb -r12319faaf20df7116346558bd948b0edda9124eb --- tests/info-method.test (.../info-method.test) (revision 85ee1fdb043ed3f82fd272cc004c476c40861fdb) +++ tests/info-method.test (.../info-method.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -364,7 +364,7 @@ ? {o info lookup methods bar} bar ? {o bar} Object.bar - o object mixin ::nx::Class + o object mixin set ::nx::Class ? {o info precedence} "::nx::Class ::nx::Object" ? {o info lookup method bar} "::nsf::classes::nx::Class::bar" ? {o info lookup methods bar} bar @@ -451,7 +451,7 @@ ? {Foo info lookup methods create} "create" ? {Foo info lookup method create} "::nsf::classes::nx::Class::create" - ? {o object mixin ""} "" + ? {o object mixin set ""} "" } @@ -721,7 +721,7 @@ ? {C info configure syntax} "/::C/ ?-a /value/? ?-b /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" # ? {C info configure syntax a} "/::C/ ?-a /value/?" - ? {C info configure parameters } "-a {-b 1} -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + ? {C info configure parameters } "-a {-b 1} -object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotassign,method=object-mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" # ? {C info parameter list} "-a -b -noinit -object-mixin -class -object-filter __initblock" # ? {C info parameter names} "a b noinit object-mixin class object-filter __initblock" @@ -833,26 +833,26 @@ ? {B info heritage} "::M1 ::A ::nx::Object" ? {B info mixin classes -closure} "::M1" - B mixin M2 + B mixin set M2 ? {A info heritage} "::nx::Object" ? {B info heritage} "::M2 ::A ::nx::Object" ? {B info mixin classes -closure} "::M2" - B mixin A + B mixin set A ? {A info heritage} "::nx::Object" ? {B info heritage} "::A ::nx::Object" - B mixin C + B mixin set C ? {A info heritage} "::nx::Object" ? {B info heritage} "::C ::A ::nx::Object" - B mixin "" + B mixin set "" ? {BB info heritage} "::B ::A ::nx::Object" - BB mixin CC + BB mixin set CC ? {BB info heritage} "::CC ::C ::B ::A ::nx::Object" - BB mixin "" + BB mixin set "" ? {BB info heritage} "::B ::A ::nx::Object" } @@ -867,31 +867,31 @@ Class create D -superclass A # transitive case - C mixin D - B mixin C + C mixin set D + B mixin set C ? {C info heritage} "::D ::A ::O ::nx::Object" ? {D info heritage} "::A ::O ::nx::Object" ? {B info heritage} "::D ::C ::A ::O ::nx::Object" # reset - C mixin "" - B mixin "" + C mixin set "" + B mixin set "" ? {B info heritage} "::A ::O ::nx::Object" ? {C info heritage} "::A ::O ::nx::Object" ? {D info heritage} "::A ::O ::nx::Object" # transitve different order - B mixin C - C mixin D + B mixin set C + C mixin set D ? {B info heritage} "::D ::C ::A ::O ::nx::Object" ? {C info heritage} "::D ::A ::O ::nx::Object" ? {D info heritage} "::A ::O ::nx::Object" # reset - C mixin "" - B mixin "" + C mixin set "" + B mixin set "" ? {B info heritage} "::A ::O ::nx::Object" ? {C info heritage} "::A ::O ::nx::Object" ? {D info heritage} "::A ::O ::nx::Object" @@ -913,39 +913,39 @@ Class create M # circular case - B mixin C - C mixin B + B mixin set C + C mixin set B ? {B info heritage} "::C ::A ::O ::nx::Object" ? {C info heritage} "::B ::A ::O ::nx::Object" ? {D info heritage} "::A ::O ::nx::Object" # reset - C mixin "" - B mixin "" + C mixin set "" + B mixin set "" ? {B info heritage} "::A ::O ::nx::Object" ? {C info heritage} "::A ::O ::nx::Object" ? {D info heritage} "::A ::O ::nx::Object" # indirect circular case - B mixin C - C mixin BB + B mixin set C + C mixin set BB ? {B info heritage} "::BB ::C ::A ::O ::nx::Object" ? {C info heritage} "::BB ::B ::A ::O ::nx::Object" ? {D info heritage} "::A ::O ::nx::Object" # reset - C mixin "" - B mixin "" + C mixin set "" + B mixin set "" ? {B info heritage} "::A ::O ::nx::Object" ? {C info heritage} "::A ::O ::nx::Object" ? {D info heritage} "::A ::O ::nx::Object" - M3 mixin B + M3 mixin set B ? {A info heritage} "::O ::nx::Object" ? {B info heritage} "::A ::O ::nx::Object" ? {M3 info heritage} "::B ::A ::O ::nx::Object" - A mixin M3 + A mixin set M3 ? {A info heritage} "::B ::M3 ::O ::nx::Object" ? {B info heritage} "::M3 ::A ::O ::nx::Object" @@ -954,7 +954,7 @@ ? {m1 info precedence} "::B ::A ::O ::M3 ::nx::Object" ? {M3 info heritage} "::B ::A ::O ::nx::Object" - B mixin M3 + B mixin set M3 ? {B info heritage} "::M3 ::A ::O ::nx::Object" } @@ -966,13 +966,13 @@ Class create MovementTest Class create MovementLog - Agent mixin MovementTest + Agent mixin set MovementTest Agent create a1 ? {Agent info heritage} "::MovementTest ::nx::Object" ? {a1 info precedence} "::MovementTest ::Agent ::nx::Object" - a1 object mixin {MovementTest MovementLog} + a1 object mixin set {MovementTest MovementLog} ? {Agent info heritage} "::MovementTest ::nx::Object" ? {a1 info precedence} "::MovementTest ::MovementLog ::Agent ::nx::Object" @@ -995,17 +995,17 @@ ? {b1 info precedence} "::B ::A ::nx::Object" ? {b1 info precedence ::M*} "" - A mixin {M1 M2} + A mixin set {M1 M2} ? {B info heritage} "::M1 ::M2 ::A ::nx::Object" ? {b1 info precedence} "::M1 ::M2 ::B ::A ::nx::Object" ? {b1 info precedence ::M*} "::M1 ::M2" ? {b1 info precedence ::X*} "" - b1 object mixin {M1 M1 M4} + b1 object mixin set {M1 M1 M4} ? {b1 info precedence} "::M1 ::M4 ::M2 ::B ::A ::nx::Object" ? {b1 info object mixin classes} "::M1 ::M4" - B mixin {M3 M1 M1 M4} + B mixin set {M3 M1 M1 M4} ? {B info heritage} "::M3 ::M1 ::M4 ::M2 ::A ::nx::Object" ? {b1 info precedence} "::M1 ::M4 ::M3 ::M2 ::B ::A ::nx::Object" } @@ -1023,12 +1023,12 @@ ? {c1 info precedence} "::C ::nx::Object" # ::A is an implied class - c1 object mixin B + c1 object mixin set B ? {c1 info precedence} "::B ::A ::C ::nx::Object" ? {c1 info object mixin classes -heritage} "::B ::A" # ::A is as well implied by ::PCM - C mixin PCM + C mixin set PCM ? {C info heritage} "::PCM ::A ::nx::Object" ? {C info mixin classes} "::PCM" ? {C info mixin classes -order} "" ;# ???? why no warning @@ -1057,7 +1057,7 @@ ? {C info heritage} "::B ::A ::nx::Object" ? {c1 info precedence} "::C ::B ::A ::nx::Object" - B mixin PCMB + B mixin set PCMB # heritage includes implied classes ? {C info heritage} "::PCMB ::PCMA ::B ::A ::nx::Object" @@ -1082,7 +1082,7 @@ # since C is a specialization of B, it inherits the classes from B ? {C info mixin classes -heritage} "::PCMB ::PCMA ::A" - PCMB mixin TPCMB + PCMB mixin set TPCMB # heritage includes implied classes ? {C info heritage} "::TPCMB ::TPCMA ::PCMB ::PCMA ::B ::A ::nx::Object" @@ -1105,7 +1105,7 @@ # since C is a specialization of B, it inherits the classes from B ? {C info mixin classes -heritage} "::TPCMB ::TPCMA ::PCMB ::PCMA ::A" - C mixin PCMC + C mixin set PCMC # heritage includes implied classes ? {C info heritage} "::PCMC ::TPCMB ::TPCMA ::PCMB ::PCMA ::B ::A ::nx::Object" @@ -1213,7 +1213,7 @@ ? {D info methods -closure *2} "d2 c2" ? {D info methods -closure -source application} "c1 d1 d2 c2" - D mixin M + D mixin set M # # Check as well methods inherited from per-class mixins Index: tests/info-variable.test =================================================================== diff -u -r85ee1fdb043ed3f82fd272cc004c476c40861fdb -r12319faaf20df7116346558bd948b0edda9124eb --- tests/info-variable.test (.../info-variable.test) (revision 85ee1fdb043ed3f82fd272cc004c476c40861fdb) +++ tests/info-variable.test (.../info-variable.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -33,7 +33,7 @@ ? {join [Person info configure parameters] \n} \ "-age:integer -name --object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n +-object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotassign,method=object-mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" Index: tests/interceptor-slot.test =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -r12319faaf20df7116346558bd948b0edda9124eb --- tests/interceptor-slot.test (.../interceptor-slot.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ tests/interceptor-slot.test (.../interceptor-slot.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -14,7 +14,7 @@ # nx::test case mixin-method { ? {C info lookup method mixin} "::nsf::classes::nx::Class::mixin" - ? {C mixin M} ::M + ? {C mixin set M} ::M ? {C info precedence} "::nx::Class ::nx::Object" ? {C mixin} "::M" ? {C info mixin classes} "::M" @@ -25,8 +25,8 @@ ? {c1 info precedence} "::M ::C ::nx::Object" ? {C mixin delete M} "" ? {C info mixin classes} "" - ? {C mixin ::M} "::M" - ? {C mixin {}} "" + ? {C mixin set ::M} "::M" + ? {C mixin set {}} "" ? {C info mixin classes} "" } @@ -90,10 +90,10 @@ # "mixin" # nx::test case class+mixin { - ? {C object mixin M} ::M + ? {C object mixin set M} ::M ? {C info precedence} "::M ::nx::Class ::nx::Object" ? {C info object mixin classes} "::M" - ? {C object mixin ""} "" + ? {C object mixin set ""} "" ? {C info precedence} "::nx::Class ::nx::Object" } @@ -104,18 +104,18 @@ ? {C object mixin add M} ::M ? {C info precedence} "::M ::nx::Class ::nx::Object" ? {C info object mixin classes} "::M" - ? {C object mixin ""} "" + ? {C object mixin set ""} "" ? {C info precedence} "::nx::Class ::nx::Object" ? {C object mixin add M} ::M ? {C info precedence} "::M ::nx::Class ::nx::Object" ? {::nsf::relation C object-mixin} ::M ? {catch {C object mixin add UNKNOWN}} 1 ? {::nsf::relation C object-mixin} "::M" - ? {C object mixin ""} "" + ? {C object mixin set ""} "" ? {C info precedence} "::nx::Class ::nx::Object" - ? {C object mixin M} ::M + ? {C object mixin set M} ::M ? {C info precedence} "::M ::nx::Class ::nx::Object" # forwarder with 0 arguments + flag @@ -133,7 +133,7 @@ nx::Class create C1 ? {C1 info lookup method mixin} "::nsf::classes::nx::Class::mixin" - C1 object mixin M1 + C1 object mixin set M1 ? {C1 info precedence} "::M1 ::nx::Class ::nx::Object" C1 create c11 ? {c11 info precedence} "::C1 ::nx::Object" @@ -143,7 +143,7 @@ ? {o info precedence} "::M1 ::nx::Object" nx::Class create O - O object mixin M1 + O object mixin set M1 ? {O info precedence} "::M1 ::nx::Class ::nx::Object" nx::Class create O -object-mixin M1 ? {O info precedence} "::M1 ::nx::Class ::nx::Object" Index: tests/interp.test =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -r12319faaf20df7116346558bd948b0edda9124eb --- tests/interp.test (.../interp.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ tests/interp.test (.../interp.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -660,7 +660,7 @@ return <[current class]>[next]<[current class]> } } - x object mixin M + x object mixin set M } ? {$i eval {x foo}} <::M>OK<::M> @@ -712,7 +712,7 @@ nx::Class create M1 nx::Class create M2 nx::Class create M3 - o object mixin {M1 M2} + o object mixin set {M1 M2} } ? {$i eval {o info precedence}} "::M1 ::M2 ::nx::Object" Index: tests/methods.test =================================================================== diff -u -r85ee1fdb043ed3f82fd272cc004c476c40861fdb -r12319faaf20df7116346558bd948b0edda9124eb --- tests/methods.test (.../methods.test) (revision 85ee1fdb043ed3f82fd272cc004c476c40861fdb) +++ tests/methods.test (.../methods.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -205,14 +205,15 @@ nx::Class create M # register the mixin on C as a object mixin and define a mixinguard - C mixin M + puts stderr XXXX=[nx::Class info method definition mixin] + C mixin set M C mixin guard M {1 == 1} ? {C info mixin guard M} "1 == 1" C mixin guard M {} ? {C info mixin guard M} "" # now the same as class mixin and class mixin guard - C object mixin M + C object mixin set M C object mixin guard M {1 == 1} ? {C info object mixin guard M} "1 == 1" C object mixin guard M {} @@ -221,19 +222,24 @@ nx::test case mixin-via-objectparam { # add an object and class mixin via object-parameter and via slots - nx::Class create M1; nx::Class create M2; nx::Class create M3; nx::Class create M4 + foreach c {M1 M2 M3 M4 M5} {nx::Class create $c} + nx::Class create C -mixin M1 -object-mixin M2 { :mixin add M3 :object mixin add M4 } ? {lsort [C info object mixin classes]} "::M2 ::M4" - #? {lsort [C info object mixin classes]} "::M2" + ? {lsort [C info mixin classes]} "::M1 ::M3" + ? {lsort [C object mixin get]} "::M2 ::M4" + ? {lsort [C mixin get]} "::M1 ::M3" + + ? {catch {C mixin M5} errorMsg} 1 ? {lsort [C info mixin classes]} "::M1 ::M3" - #? {lsort [C info mixin classes]} "::M1" - C destroy - M1 destroy; M2 destroy; M3 destroy; M4 destroy; + + ? {catch {C object mixin M5} errorMsg} 1 + ? {lsort [C info object mixin classes]} "::M2 ::M4" } # testing next via nonpos-args @@ -252,7 +258,7 @@ } } - o object mixin M + o object mixin set M ? {o bar -x 13 -y 14} "x 13 y 14 {-x 13 -y 14} -- x 13 y 14 {-x 13 -y 14}" ? {o bar -y 14 -x 13} "x 13 y 14 {-y 14 -x 13} -- x 13 y 14 {-y 14 -x 13}" } @@ -1161,7 +1167,7 @@ ? {c1 foo} 1 ? {c1 bar} 2 - db object mixin Profile + db object mixin set Profile ? {c1 foo} 1 ? {c1 bar} 2 @@ -1225,7 +1231,7 @@ ? bar0 2 ? bar 2 - ns_cache object mixin Profile + ns_cache object mixin set Profile # the version with tcl-uplevel should fail ? bar0 {can't read "x": no such variable} Index: tests/mixinof.test =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -r12319faaf20df7116346558bd948b0edda9124eb --- tests/mixinof.test (.../mixinof.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ tests/mixinof.test (.../mixinof.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -27,7 +27,7 @@ nx::Class create C -superclass B nx::Class create M -B mixin M +B mixin set M nx::Object create o -object-mixin C nx::Object create o1 -object-mixin B @@ -123,7 +123,7 @@ nx::Class create A nx::Class create B -mixin A nx::Class create C -superclass B -A mixin [nx::Class create M] +A mixin set [nx::Class create M] A create a1 B create b1 @@ -174,7 +174,7 @@ ? {A info mixinof -scope class -closure} "" ? {B info mixinof -scope class -closure} "" ? {X info mixinof -scope class -closure} "" -D mixin X +D mixin set X ? {C info mixinof -scope class -closure} "::A ::B" ? {D info mixinof -scope class -closure} "" ? {A info mixinof -scope class -closure} "" @@ -194,8 +194,8 @@ nx::Class create B3 -superclass [nx::Class create B2 -superclass [nx::Class create B1 -superclass [nx::Class create B0]]] nx::Class create C3 -superclass [nx::Class create C2 -superclass [nx::Class create C1]] -A2 mixin B2 -B1 mixin C2 +A2 mixin set B2 +B1 mixin set C2 ? {A1 info mixinof -scope class -closure} "" ? {A2 info mixinof -scope class -closure} "" @@ -494,7 +494,7 @@ ? {c1 info object mixin classes} ::A ? {lsort [A info mixinof]} "::C2 ::c1" ? {M info mixinof} "" - C mixin M + C mixin set M #? {M info mixinof -scope object} "::c1 ::c2" ? {M info mixinof -scope object} "" ? {M info mixinof -scope class} "::C" Index: tests/parameters.test =================================================================== diff -u -r85ee1fdb043ed3f82fd272cc004c476c40861fdb -r12319faaf20df7116346558bd948b0edda9124eb --- tests/parameters.test (.../parameters.test) (revision 85ee1fdb043ed3f82fd272cc004c476c40861fdb) +++ tests/parameters.test (.../parameters.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -4,6 +4,9 @@ #::nx::configure defaultMethodCallProtection false +set ::trailer "-object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotassign,method=object-mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + + nx::test case dummy { ? {::namespace current} :: set o [Object create o] @@ -44,7 +47,7 @@ } C create c1 nx::Class create M - c1 object mixin M + c1 object mixin set M ? {::nsf::object::exists o1} 1 ? {::nsf::object::exists o1000} 0 @@ -275,7 +278,7 @@ C create c1 ? {C eval :__objectparameter} \ - "{-superclass:class,alias,method=::nsf::methods::class::superclass,1..n ::nx::Object} -mixin:mixinreg,alias,0..n -filter:filterreg,alias,0..n -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + "{-superclass:class,alias,method=::nsf::methods::class::superclass,1..n ::nx::Object} -mixin:mixinreg,slot=::nx::Class::slot::mixin,slotassign,method=class-mixin,0..n -filter:filterreg,alias,0..n -object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotassign,method=object-mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" #### TOOD: remove or add #? {c1 eval :__objectparameter} \ @@ -307,7 +310,7 @@ "::D::slot::d ::C::slot::a ::C::slot::b ::C::slot::c" ? {d1 eval :__objectparameter} \ - "-d:required -a -b:boolean {-c 1} -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + "-d:required -a -b:boolean {-c 1} $::trailer" } ####################################################### @@ -333,32 +336,32 @@ nx::Class create M2 { :property b2 } - D mixin M + D mixin set M ? {d1 eval :__objectparameter} \ - "-b -m1 -m2 -d:required -a {-c 1} -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" \ + "-b -m1 -m2 -d:required -a {-c 1} $::trailer" \ "mixin added" - M mixin M2 + M mixin set M2 ? {d1 eval :__objectparameter} \ - "-b2 -b -m1 -m2 -d:required -a {-c 1} -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" \ + "-b2 -b -m1 -m2 -d:required -a {-c 1} $::trailer" \ "transitive mixin added" - D mixin "" + D mixin set "" #we should have again the old interface ? {d1 eval :__objectparameter} \ - "-d:required -a -b:boolean {-c 1} -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + "-d:required -a -b:boolean {-c 1} $::trailer" - C mixin M + C mixin set M ? {d1 eval :__objectparameter} \ - "-b2 -b -m1 -m2 -d:required -a {-c 1} -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" \ - "mixin added" - C mixin "" + "-b2 -b -m1 -m2 -d:required -a {-c 1} $::trailer" \ + "mixin added" + C mixin set "" #we should have again the old interface ? {d1 eval :__objectparameter} \ - "-d:required -a -b:boolean {-c 1} -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + "-d:required -a -b:boolean {-c 1} $::trailer" } ####################################################### @@ -1901,13 +1904,13 @@ nx::Class create M1 {:property b1:required} nx::Class create M2 {:property b2:required} - ? {c1 eval :__objectparameter} "-a1 -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + ? {c1 eval :__objectparameter} "-a1 $::trailer" - c1 object mixin M1 + c1 object mixin set M1 ? {c1 info precedence} "::M1 ::C ::nx::Object" - ? {c1 eval :__objectparameter} "-b1:required -a1 -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + ? {c1 eval :__objectparameter} "-b1:required -a1 $::trailer" # # Invalidate the object parameter and expect that the per-class @@ -1960,7 +1963,7 @@ # # drop the mixins, the b* properties should be gone. # - c1 object mixin "" + c1 object mixin set "" ? {c1 info object mixin classes} {} ? {lsort [c1 info lookup configure parameters b*]} "" @@ -2001,15 +2004,15 @@ nx::Class create D -superclass C nx::Class create M {:property b1:required} - c1 object mixin M + c1 object mixin set M ? {c1 info precedence} "::M ::C ::nx::Object" ? {C info slots -closure} \ "::C::slot::a1 ::nx::Object::slot::__initblock ::nx::Object::slot::object-mixin ::nx::Object::slot::class ::nx::Object::slot::object-filter" ? {c1 eval :__objectparameter} \ - "-a2 -b1:required -a1 -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + "-a2 -b1:required -a1 $::trailer" # # invalidate object parameter and expect that the per-class mixin @@ -2025,7 +2028,7 @@ ? {C info slots -closure} \ "::C::slot::a1 ::nx::Object::slot::__initblock ::nx::Object::slot::object-mixin ::nx::Object::slot::class ::nx::Object::slot::object-filter" - ? {c1 eval :__objectparameter} "-a2 -b1:required -a1 -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,0..n __initblock:cmd,optional,noleadingdash" + ? {c1 eval :__objectparameter} "-a2 -b1:required -a1 $::trailer" # should not require b1 ? {C create c2} ::c2 Index: tests/plain-object-method.test =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -r12319faaf20df7116346558bd948b0edda9124eb --- tests/plain-object-method.test (.../plain-object-method.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ tests/plain-object-method.test (.../plain-object-method.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -7,7 +7,7 @@ ? {o public method foo {} {return foo}} "::o: unable to dispatch method 'method'" :public object method f args {next} } - ? {o mixin M1} "::o: unable to dispatch method 'mixin'" + ? {o mixin set M1} "::o: unable to dispatch method 'mixin'" ? {o filter f} "::o: unable to dispatch method 'filter'" ? {lsort [o info object methods]} "f" @@ -49,9 +49,9 @@ ? {o a} "pm1" ? {o fwd} "pm1" - ? {o mixin M1} ::M1 + ? {o mixin set M1} ::M1 ? {o info mixin classes} ::M1 - ? {o mixin ""} "" + ? {o mixin set ""} "" ? {o info mixin classes} "" ? {o filter f} f Index: tests/submethods.test =================================================================== diff -u -r85ee1fdb043ed3f82fd272cc004c476c40861fdb -r12319faaf20df7116346558bd948b0edda9124eb --- tests/submethods.test (.../submethods.test) (revision 85ee1fdb043ed3f82fd272cc004c476c40861fdb) +++ tests/submethods.test (.../submethods.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -161,7 +161,7 @@ } } - FOO mixin {M1 M0} + FOO mixin set {M1 M0} FOO create f1 # @@ -393,19 +393,19 @@ C create c ? {c FOO foo} -::c-::C- - C mixin [Class create M1 { + C mixin set [Class create M1 { :public method "FOO foo" {} { return "-[current]-[current class][next]" } }] ? {c FOO foo} -::c-::M1-::c-::C- - o object mixin ::M1 + o object mixin set ::M1 ? {o FOO foo} -::o-::M1-::o-- - o object mixin {} - C mixin {} + o object mixin set {} + C mixin set {} # # limit [current methodpath] to collect only ensemble methods? Index: tests/varresolution.test =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -r12319faaf20df7116346558bd948b0edda9124eb --- tests/varresolution.test (.../varresolution.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ tests/varresolution.test (.../varresolution.test) (revision 12319faaf20df7116346558bd948b0edda9124eb) @@ -722,7 +722,7 @@ nx::Class create M1 nx::Class create M2 - C mixin M1 + C mixin set M1 ? {::nsf::relation C class-mixin} "::module::M1" C mixin add M2 @@ -1128,7 +1128,7 @@ return $package_id } - FormPage mixin WorkflowPage + FormPage mixin add WorkflowPage FormPage create p1 -package_id 123 ? {p1 initialize_loaded_object} 123