Index: TODO =================================================================== diff -u -r4d02778de9877814d5d078fa5a4e34e40f57bcff -r513f795175db0329e73b1c7d14fb73255d62235a --- TODO (.../TODO) (revision 4d02778de9877814d5d078fa5a4e34e40f57bcff) +++ TODO (.../TODO) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -1113,6 +1113,14 @@ - extended regression test - updated migration guide +- replaced "obj|cls mixinguard name cond" by "obj|cls mixin guard name cond" +- replaced "obj|cls info mixinguard name" by "obj|cls info mixin -guard name" +- replaced "cls object info mixinguard name" by "cls object info mixin -guard name" +- removed XOTclObjInfoMixinguardMethod() +- removed XOTclClassInfoMixinguardMethod() +- extended regression test +- updated migration guide + TODO: - interfaces in documentation for slots (see for more details Index: doc/next-migration.html =================================================================== diff -u -r4d02778de9877814d5d078fa5a4e34e40f57bcff -r513f795175db0329e73b1c7d14fb73255d62235a --- doc/next-migration.html (.../next-migration.html) (revision 4d02778de9877814d5d078fa5a4e34e40f57bcff) +++ doc/next-migration.html (.../next-migration.html) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -779,34 +779,34 @@ XOTclNext Scripting Language cls instmixin ...
- cls instmixinguard ... + cls instmixinguard mixin condition # Register per-class mixin and guard for a class

cls mixin ...
- cls mixinguard ... + cls mixin guard mixin condition cls mixin ...
- cls mixinguard ... + cls mixin guard mixin condition # Register per-object mixin and guard for a class

cls object mixin ...
- cls object mixinguard ...
+ cls object mixin guard mixin condition
obj mixin ...
- obj mixinguard ... + obj mixinguard mixin condition # Register per-object mixin and guard for an object

obj mixin ...
- obj mixinguard ... + obj mixin guard mixin condition @@ -817,12 +817,12 @@ XOTclNext Scripting Language cls instfilter ...
- cls instfilterguard ... + cls instfilterguard filter condition # Register per-class filter and guard for a class

cls filter ...
- cls filter guard ... + cls filter guard filter condition @@ -839,13 +839,13 @@ obj filter ...
- obj filterguard ... + obj filterguard filter condition # Register per-object filter and guard for an object

obj filter ...
- obj filter guard ... + obj filter guard filter condition @@ -1081,7 +1081,7 @@ obj info filter ?-guards? ?-order? ?pattern? # ... info filter -order ... returns method-handles
# instead of triples (applies to all three variants)


- obj info filter ?-guard? ?-guards? ?-order? ?pattern? + obj info filter ?-guards? ?-order? ?pattern? obj info filterguard name @@ -1091,7 +1091,7 @@ cls info filter ?-guards? ?-order? ?pattern? - cls object info filter ?-guard? ?-guards? ?-order? ?pattern? + cls object info filter ?-guards? ?-order? ?pattern? @@ -1102,7 +1102,7 @@ cls info instfilter ?-guards? ?-order? ?pattern? - cls info filter ?-guard? ?-guards? ?-order? ?pattern? + cls info filter ?-guards? ?-order? ?pattern? cls info instfilterguard name @@ -1114,16 +1114,34 @@ obj info mixin ?-guards? ?-order? ?pattern? obj info mixin ?-guards? ?-order? ?pattern? - + obj info mixinguard name + obj info mixin -guard name
+
obj mixin guard name
+ + + cls info mixin ?-guards? ?-order? ?pattern? cls object info mixin ?-guards? ?-order? ?pattern? + + cls info mixinguard name + cls object info mixin -guard name
+
cls object mixin guard name
+ + + cls info instmixin ?-guards? ?-order? ?pattern? cls info mixin ?-guards? ?-order? ?pattern? - + + + + cls info instmixinguard name + cls info mixin -guard name
+
cls mixin guard name
+

List definition of methods defined by aliases, setters or forwarders

@@ -1417,6 +1435,6 @@
- Last modified: Sun Aug 22 14:13:15 CEST 2010 + Last modified: Sun Aug 22 19:32:43 CEST 2010 Index: generic/gentclAPI.decls =================================================================== diff -u -r4d02778de9877814d5d078fa5a4e34e40f57bcff -r513f795175db0329e73b1c7d14fb73255d62235a --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision 4d02778de9877814d5d078fa5a4e34e40f57bcff) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -791,14 +791,11 @@ } infoObjectMethod mixin XOTclObjInfoMixinMethod { {-argName "object" -required 1 -type object} + {-argName "-guard"} {-argName "-guards"} {-argName "-order"} {-argName "pattern" -type objpattern} } -infoObjectMethod mixinguard XOTclObjInfoMixinguardMethod { - {-argName "object" -required 1 -type object} - {-argName "mixin" -required 1} -} infoObjectMethod parent XOTclObjInfoParentMethod { {-argName "object" -required 1 -type object} } @@ -856,13 +853,10 @@ infoClassMethod mixin XOTclClassInfoMixinMethod { {-argName "class" -required 1 -type class} {-argName "-closure"} + {-argName "-guard"} {-argName "-guards"} {-argName "pattern" -type objpattern} } -infoClassMethod mixinguard XOTclClassInfoMixinguardMethod { - {-argName "class" -required 1 -type class} - {-argName "mixin" -required 1} -} infoClassMethod mixinof XOTclClassInfoMixinOfMethod { {-argName "class" -required 1 -type class} {-argName "-closure"} Index: generic/tclAPI.h =================================================================== diff -u -r4d02778de9877814d5d078fa5a4e34e40f57bcff -r513f795175db0329e73b1c7d14fb73255d62235a --- generic/tclAPI.h (.../tclAPI.h) (revision 4d02778de9877814d5d078fa5a4e34e40f57bcff) +++ generic/tclAPI.h (.../tclAPI.h) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -160,7 +160,6 @@ static int XOTclClassInfoMethodsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoMixinMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoMixinOfMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclClassInfoMixinguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoSlotsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoSubclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclClassInfoSuperclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -173,7 +172,6 @@ static int XOTclObjInfoMethodMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclObjInfoMethodsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclObjInfoMixinMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclObjInfoMixinguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclObjInfoParentMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclObjInfoPrecedenceMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int XOTclObjInfoSlotObjectsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -233,9 +231,8 @@ static int XOTclClassInfoInstancesMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, CONST char *patternString, XOTclObject *patternObj); static int XOTclClassInfoMethodMethod(Tcl_Interp *interp, XOTclClass *class, int infomethodsubcmd, CONST char *name); static int XOTclClassInfoMethodsMethod(Tcl_Interp *interp, XOTclClass *class, int withMethodtype, int withCallprotection, int withNomixins, int withIncontext, CONST char *pattern); -static int XOTclClassInfoMixinMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, int withGuards, CONST char *patternString, XOTclObject *patternObj); +static int XOTclClassInfoMixinMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, int withGuard, int withGuards, CONST char *patternString, XOTclObject *patternObj); static int XOTclClassInfoMixinOfMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, int withScope, CONST char *patternString, XOTclObject *patternObj); -static int XOTclClassInfoMixinguardMethod(Tcl_Interp *interp, XOTclClass *class, CONST char *mixin); static int XOTclClassInfoSlotsMethod(Tcl_Interp *interp, XOTclClass *class); static int XOTclClassInfoSubclassMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, CONST char *patternString, XOTclObject *patternObj); static int XOTclClassInfoSuperclassMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, Tcl_Obj *pattern); @@ -247,8 +244,7 @@ static int XOTclObjInfoHasnamespaceMethod(Tcl_Interp *interp, XOTclObject *object); static int XOTclObjInfoMethodMethod(Tcl_Interp *interp, XOTclObject *object, int infomethodsubcmd, CONST char *name); static int XOTclObjInfoMethodsMethod(Tcl_Interp *interp, XOTclObject *object, int withMethodtype, int withCallprotection, int withNomixins, int withIncontext, CONST char *pattern); -static int XOTclObjInfoMixinMethod(Tcl_Interp *interp, XOTclObject *object, int withGuards, int withOrder, CONST char *patternString, XOTclObject *patternObj); -static int XOTclObjInfoMixinguardMethod(Tcl_Interp *interp, XOTclObject *object, CONST char *mixin); +static int XOTclObjInfoMixinMethod(Tcl_Interp *interp, XOTclObject *object, int withGuard, int withGuards, int withOrder, CONST char *patternString, XOTclObject *patternObj); static int XOTclObjInfoParentMethod(Tcl_Interp *interp, XOTclObject *object); static int XOTclObjInfoPrecedenceMethod(Tcl_Interp *interp, XOTclObject *object, int withIntrinsic, CONST char *pattern); static int XOTclObjInfoSlotObjectsMethod(Tcl_Interp *interp, XOTclObject *object, CONST char *pattern); @@ -311,7 +307,6 @@ XOTclClassInfoMethodsMethodIdx, XOTclClassInfoMixinMethodIdx, XOTclClassInfoMixinOfMethodIdx, - XOTclClassInfoMixinguardMethodIdx, XOTclClassInfoSlotsMethodIdx, XOTclClassInfoSubclassMethodIdx, XOTclClassInfoSuperclassMethodIdx, @@ -324,7 +319,6 @@ XOTclObjInfoMethodMethodIdx, XOTclObjInfoMethodsMethodIdx, XOTclObjInfoMixinMethodIdx, - XOTclObjInfoMixinguardMethodIdx, XOTclObjInfoParentMethodIdx, XOTclObjInfoPrecedenceMethodIdx, XOTclObjInfoSlotObjectsMethodIdx, @@ -657,21 +651,22 @@ } else { XOTclClass *class = (XOTclClass *)pc.clientData[0]; int withClosure = (int )PTR2INT(pc.clientData[1]); - int withGuards = (int )PTR2INT(pc.clientData[2]); + int withGuard = (int )PTR2INT(pc.clientData[2]); + int withGuards = (int )PTR2INT(pc.clientData[3]); CONST char *patternString = NULL; XOTclObject *patternObj = NULL; - Tcl_Obj *pattern = (Tcl_Obj *)pc.clientData[3]; + Tcl_Obj *pattern = (Tcl_Obj *)pc.clientData[4]; int returnCode; - if (getMatchObject(interp, pattern, objc>3 ? objv[3] : NULL, &patternObj, &patternString) == -1) { + if (getMatchObject(interp, pattern, objc>4 ? objv[4] : NULL, &patternObj, &patternString) == -1) { if (pattern) { DECR_REF_COUNT(pattern); } return TCL_OK; } parseContextRelease(&pc); - returnCode = XOTclClassInfoMixinMethod(interp, class, withClosure, withGuards, patternString, patternObj); + returnCode = XOTclClassInfoMixinMethod(interp, class, withClosure, withGuard, withGuards, patternString, patternObj); if (pattern) { DECR_REF_COUNT(pattern); @@ -716,25 +711,6 @@ } static int -XOTclClassInfoMixinguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - parseContext pc; - - if (ArgumentParse(interp, objc, objv, NULL, objv[0], - method_definitions[XOTclClassInfoMixinguardMethodIdx].paramDefs, - method_definitions[XOTclClassInfoMixinguardMethodIdx].nrParameters, - &pc) != TCL_OK) { - return TCL_ERROR; - } else { - XOTclClass *class = (XOTclClass *)pc.clientData[0]; - CONST char *mixin = (CONST char *)pc.clientData[1]; - - parseContextRelease(&pc); - return XOTclClassInfoMixinguardMethod(interp, class, mixin); - - } -} - -static int XOTclClassInfoSlotsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; @@ -982,22 +958,23 @@ return TCL_ERROR; } else { XOTclObject *object = (XOTclObject *)pc.clientData[0]; - int withGuards = (int )PTR2INT(pc.clientData[1]); - int withOrder = (int )PTR2INT(pc.clientData[2]); + int withGuard = (int )PTR2INT(pc.clientData[1]); + int withGuards = (int )PTR2INT(pc.clientData[2]); + int withOrder = (int )PTR2INT(pc.clientData[3]); CONST char *patternString = NULL; XOTclObject *patternObj = NULL; - Tcl_Obj *pattern = (Tcl_Obj *)pc.clientData[3]; + Tcl_Obj *pattern = (Tcl_Obj *)pc.clientData[4]; int returnCode; - if (getMatchObject(interp, pattern, objc>3 ? objv[3] : NULL, &patternObj, &patternString) == -1) { + if (getMatchObject(interp, pattern, objc>4 ? objv[4] : NULL, &patternObj, &patternString) == -1) { if (pattern) { DECR_REF_COUNT(pattern); } return TCL_OK; } parseContextRelease(&pc); - returnCode = XOTclObjInfoMixinMethod(interp, object, withGuards, withOrder, patternString, patternObj); + returnCode = XOTclObjInfoMixinMethod(interp, object, withGuard, withGuards, withOrder, patternString, patternObj); if (pattern) { DECR_REF_COUNT(pattern); @@ -1007,25 +984,6 @@ } static int -XOTclObjInfoMixinguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - parseContext pc; - - if (ArgumentParse(interp, objc, objv, NULL, objv[0], - method_definitions[XOTclObjInfoMixinguardMethodIdx].paramDefs, - method_definitions[XOTclObjInfoMixinguardMethodIdx].nrParameters, - &pc) != TCL_OK) { - return TCL_ERROR; - } else { - XOTclObject *object = (XOTclObject *)pc.clientData[0]; - CONST char *mixin = (CONST char *)pc.clientData[1]; - - parseContextRelease(&pc); - return XOTclObjInfoMixinguardMethod(interp, object, mixin); - - } -} - -static int XOTclObjInfoParentMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; @@ -1917,9 +1875,10 @@ {"-incontext", 0, 0, convertToString}, {"pattern", 0, 0, convertToString}} }, -{"::nsf::cmd::ClassInfo::mixin", XOTclClassInfoMixinMethodStub, 4, { +{"::nsf::cmd::ClassInfo::mixin", XOTclClassInfoMixinMethodStub, 5, { {"class", 1, 0, convertToClass}, {"-closure", 0, 0, convertToString}, + {"-guard", 0, 0, convertToString}, {"-guards", 0, 0, convertToString}, {"pattern", 0, 0, convertToObjpattern}} }, @@ -1929,10 +1888,6 @@ {"-scope", 0, 1, convertToScope}, {"pattern", 0, 0, convertToObjpattern}} }, -{"::nsf::cmd::ClassInfo::mixinguard", XOTclClassInfoMixinguardMethodStub, 2, { - {"class", 1, 0, convertToClass}, - {"mixin", 1, 0, convertToString}} -}, {"::nsf::cmd::ClassInfo::slots", XOTclClassInfoSlotsMethodStub, 1, { {"class", 1, 0, convertToClass}} }, @@ -1991,16 +1946,13 @@ {"-incontext", 0, 0, convertToString}, {"pattern", 0, 0, convertToString}} }, -{"::nsf::cmd::ObjectInfo::mixin", XOTclObjInfoMixinMethodStub, 4, { +{"::nsf::cmd::ObjectInfo::mixin", XOTclObjInfoMixinMethodStub, 5, { {"object", 1, 0, convertToObject}, + {"-guard", 0, 0, convertToString}, {"-guards", 0, 0, convertToString}, {"-order", 0, 0, convertToString}, {"pattern", 0, 0, convertToObjpattern}} }, -{"::nsf::cmd::ObjectInfo::mixinguard", XOTclObjInfoMixinguardMethodStub, 2, { - {"object", 1, 0, convertToObject}, - {"mixin", 1, 0, convertToString}} -}, {"::nsf::cmd::ObjectInfo::parent", XOTclObjInfoParentMethodStub, 1, { {"object", 1, 0, convertToObject}} }, Index: generic/xotcl.c =================================================================== diff -u -r4d02778de9877814d5d078fa5a4e34e40f57bcff -r513f795175db0329e73b1c7d14fb73255d62235a --- generic/xotcl.c (.../xotcl.c) (revision 4d02778de9877814d5d078fa5a4e34e40f57bcff) +++ generic/xotcl.c (.../xotcl.c) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -13970,15 +13970,19 @@ /* infoObjectMethod mixin XOTclObjInfoMixinMethod { {-argName "object" -required 1 -type object} + {-argName "-guard"} {-argName "-guards"} {-argName "-order"} {-argName "pattern" -type objpattern} } */ static int XOTclObjInfoMixinMethod(Tcl_Interp *interp, XOTclObject *object, - int withGuards, int withOrder, + int withGuard, int withGuards, int withOrder, CONST char *patternString, XOTclObject *patternObj) { + if (withGuard) { + return object->opt ? GuardList(interp, object->opt->mixins, patternString) : TCL_OK; + } if (withOrder) { if (!(object->flags & XOTCL_MIXIN_ORDER_VALID)) MixinComputeDefined(interp, object); @@ -13989,16 +13993,6 @@ } /* -infoObjectMethod mixinguard XOTclObjInfoMixinguardMethod { - {-argName "object" -required 1 -type object} - {-argName "mixin" -required 1} -} -*/ -static int XOTclObjInfoMixinguardMethod(Tcl_Interp *interp, XOTclObject *object, CONST char *mixin) { - return object->opt ? GuardList(interp, object->opt->mixins, mixin) : TCL_OK; -} - -/* infoObjectMethod parent XOTclObjInfoParentMethod { {-argName "object" -required 1 -type object} } @@ -14222,15 +14216,20 @@ infoClassMethod mixin XOTclClassInfoMixinMethod { {-argName "class" -required 1 -type class} {-argName "-closure"} + {-argName "-guard"} {-argName "-guards"} {-argName "pattern" -type objpattern} } */ -static int XOTclClassInfoMixinMethod(Tcl_Interp *interp, XOTclClass *class, int withClosure, int withGuards, +static int XOTclClassInfoMixinMethod(Tcl_Interp *interp, XOTclClass *class, + int withClosure, int withGuard, int withGuards, CONST char *patternString, XOTclObject *patternObj) { XOTclClassOpt *opt = class->opt; int rc; + if (withGuard) { + return opt ? GuardList(interp, opt->classmixins, patternString) : TCL_OK; + } if (withClosure) { Tcl_HashTable objTable, *commandTable = &objTable; MEM_COUNT_ALLOC("Tcl_InitHashTable", commandTable); @@ -14249,16 +14248,6 @@ } /* -infoClassMethod mixinguard XOTclClassInfoMixinguardMethod { - {-argName "class" -required 1 -type class} - {-argName "mixin" -required 1} -} -*/ -static int XOTclClassInfoMixinguardMethod(Tcl_Interp *interp, XOTclClass *class, CONST char *mixin) { - return class->opt ? GuardList(interp, class->opt->classmixins, mixin) : TCL_OK; -} - -/* infoClassMethod mixinof XOTclClassInfoMixinOfMethod { {-argName "class" -required 1 -type class} {-argName "-closure"} Index: library/nx/nx.tcl =================================================================== diff -u -r4d02778de9877814d5d078fa5a4e34e40f57bcff -r513f795175db0329e73b1c7d14fb73255d62235a --- library/nx/nx.tcl (.../nx.tcl) (revision 4d02778de9877814d5d078fa5a4e34e40f57bcff) +++ library/nx/nx.tcl (.../nx.tcl) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -37,7 +37,7 @@ # foreach cmd [info command ::nsf::cmd::Object::*] { set cmdName [namespace tail $cmd] - if {$cmdName in [list "autoname" "exists" "filterguard" "instvar" "requireNamespace"]} continue + if {$cmdName in [list "autoname" "exists" "filterguard" "instvar" "mixinguard" "requireNamespace"]} continue ::nsf::alias Object $cmdName $cmd } @@ -47,7 +47,7 @@ # provide the standard command set for Class foreach cmd [info command ::nsf::cmd::Class::*] { set cmdName [namespace tail $cmd] - if {$cmdName in [list "filterguard"]} continue + if {$cmdName in [list "filterguard" "mixinguard"]} continue ::nsf::alias Class $cmdName $cmd } @@ -1000,7 +1000,7 @@ ::nx::RelationSlot create ${os}::Class::slot::object-filter -elementtype "" -noforwarder 1 # - # Define method "guard" for Object and Class + # Define method "guard" for mixin- and filter-slots of Object and Class # ${os}::Object::slot::filter method guard {obj prop filter guard:optional} { if {[info exists guard]} { @@ -1016,6 +1016,20 @@ $obj info filter -guard $filter } } + ${os}::Object::slot::mixin method guard {obj prop filter guard:optional} { + if {[info exists guard]} { + ::nsf::dispatch $obj ::nsf::cmd::Object::mixinguard $filter $guard + } else { + $obj info mixin -guard $filter + } + } + ${os}::Class::slot::mixin method guard {obj prop filter guard:optional} { + if {[info exists guard]} { + ::nsf::dispatch $obj ::nsf::cmd::Class::mixinguard $filter $guard + } else { + $obj info mixin -guard $filter + } + } #::nsf::alias ::nx::Class::slot::object-filter guard ${os}::Object::slot::filter::guard } Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r4d02778de9877814d5d078fa5a4e34e40f57bcff -r513f795175db0329e73b1c7d14fb73255d62235a --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 4d02778de9877814d5d078fa5a4e34e40f57bcff) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -338,6 +338,9 @@ :proc filterguard {o filter} {::nsf::cmd::ObjectInfo::filter $o -guard $filter} :proc instfilterguard {o filter} {::nsf::cmd::ClassInfo::filter $o -guard $filter} + :proc mixinguard {o mixin} {::nsf::cmd::ObjectInfo::mixin $o -guard $mixin} + :proc instmixinguard {o mixin} {::nsf::cmd::ClassInfo::mixin $o -guard $mixin} + # assertion handling :proc instinvar {o} {::nsf::assertion $o class-invar} } @@ -385,6 +388,7 @@ return $def } :proc filterguard {o filter} {::nsf::cmd::ObjectInfo::filter $o -guard $filter} + :proc mixinguard {o mixin} {::nsf::cmd::ObjectInfo::mixin $o -guard $mixin} # assertion handling :proc check {o} { @@ -415,12 +419,10 @@ ::nsf::alias ::xotcl::classInfo classparent ::nsf::cmd::ObjectInfo::parent ::nsf::alias ::xotcl::classInfo classchildren ::nsf::cmd::ObjectInfo::children ::nsf::alias ::xotcl::classInfo instmixin ::nsf::cmd::ClassInfo::mixin - ::nsf::alias ::xotcl::classInfo instmixinguard ::nsf::cmd::ClassInfo::mixinguard - #::nsf::alias ::xotcl::classInfo instmixinof ::nsf::cmd::ClassInfo::class-mixin-of + ::nsf::forward ::xotcl::classInfo instmixinof ::nsf::cmd::ClassInfo::mixinof %1 -scope class ::nsf::alias ::xotcl::classInfo instfilter ::nsf::cmd::ClassInfo::filter ::nsf::alias ::xotcl::classInfo instforward ::nsf::cmd::ClassInfo::forward - #::nsf::alias ::xotcl::classInfo mixinof ::nsf::cmd::ClassInfo::object-mixin-of ::nsf::forward ::xotcl::classInfo mixinof ::nsf::cmd::ClassInfo::mixinof %1 -scope object ::nsf::alias ::xotcl::classInfo parameter ::nx::classInfo::parameter Index: tests/info-method.tcl =================================================================== diff -u -r4d02778de9877814d5d078fa5a4e34e40f57bcff -r513f795175db0329e73b1c7d14fb73255d62235a --- tests/info-method.tcl (.../info-method.tcl) (revision 4d02778de9877814d5d078fa5a4e34e40f57bcff) +++ tests/info-method.tcl (.../info-method.tcl) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -81,13 +81,19 @@ o mixin ::nx::Class ? {o info callable method bar} "::nsf::classes::nx::Class::bar" ? {o info callable methods bar} bar + ? {o info callable methods superclass} "" + ? {o info callable method superclass} "" ? {o bar} Class.bar ? {o method foo {} {return o.foo}} "::o::foo" ? {o alias is ::nsf::objectproperty} "::o::is" ? {o setter x} "::o::x" ? {lsort [o info methods]} "foo is x" + ? {o attribute A} ::o::A + ? {o forward fwd ::set} ::o::fwd + ? {lsort [o info methods]} "A foo fwd is x" + o method f args ::nx::next ? {o info callable methods superclass} "" ? {o info callable methods filter} "filter" @@ -120,17 +126,38 @@ ? {Foo object info filter -guards f2} "f2" ? {Foo object info filter -guards} "{f -guard {2 == 2}} f2" ? {Foo object filter {}} "" + Foo destroy nx::Class create Fly o mixin add Fly ? {o info mixin} "::Fly ::nx::Class" - ? {o mixinguard ::Fly {1}} "" + ? {o mixin guard ::Fly {1}} "" + ? {o info mixin -guards} "{::Fly -guard 1} ::nx::Class" + ? {o info mixin -guards Fly} "{::Fly -guard 1}" o mixin delete ::Fly ? {o info mixin} "::nx::Class" - ? {o attribute A} ::o::A - ? {o forward fwd ::set} ::o::fwd - ? {lsort [o info methods]} "A f foo fwd is x" + nx::Class create Foo + Foo mixin add ::nx::Class + Foo mixin add Fly + ? {Foo info mixin} "::Fly ::nx::Class" + ? {Foo mixin guard ::Fly {1}} "" + ? {Foo info mixin -guards} "{::Fly -guard 1} ::nx::Class" + ? {Foo info mixin -guards Fly} "{::Fly -guard 1}" + Foo mixin delete ::Fly + ? {Foo info mixin} "::nx::Class" + Foo object mixin add ::nx::Class + Foo object mixin add Fly + ? {Foo object info mixin} "::Fly ::nx::Class" + ? {Foo object mixin guard ::Fly {1}} "" + ? {Foo object info mixin -guards} "{::Fly -guard 1} ::nx::Class" + ? {Foo object info mixin -guards Fly} "{::Fly -guard 1}" + Foo object mixin delete ::Fly + ? {Foo object info mixin} "::nx::Class" + + ? {Foo info callable methods superclass} "superclass" + ? {Foo info callable method superclass} "::nsf::classes::nx::Class::superclass" + ? {o mixin ""} "" } Index: tests/method-modifiers.tcl =================================================================== diff -u -re548a952433b4d26794f535995c9ed1ababe8807 -r513f795175db0329e73b1c7d14fb73255d62235a --- tests/method-modifiers.tcl (.../method-modifiers.tcl) (revision e548a952433b4d26794f535995c9ed1ababe8807) +++ tests/method-modifiers.tcl (.../method-modifiers.tcl) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -178,20 +178,20 @@ # define a Class C and mixin class M Class create C Class create M - # register the mixin on C as a class mixin and define a class - # mixinguard + + # register the mixin on C as a class mixin and define a mixinguard C mixin M - C mixinguard M {1 == 1} - ? {C info mixinguard M} "1 == 1" - C mixinguard M {} - ? {C info mixinguard 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 object mixin and object mixin guard C object mixin M - C object mixinguard M {1 == 1} - ? {C object info mixinguard M} "1 == 1" - C object mixinguard M {} - ? {C object info mixinguard M} "" + C object mixin guard M {1 == 1} + ? {C object info mixin -guard M} "1 == 1" + C object mixin guard M {} + ? {C object info mixin -guard M} "" } Test case mixin-via-objectparam { Index: tests/mixinoftest.tcl =================================================================== diff -u -re548a952433b4d26794f535995c9ed1ababe8807 -r513f795175db0329e73b1c7d14fb73255d62235a --- tests/mixinoftest.tcl (.../mixinoftest.tcl) (revision e548a952433b4d26794f535995c9ed1ababe8807) +++ tests/mixinoftest.tcl (.../mixinoftest.tcl) (revision 513f795175db0329e73b1c7d14fb73255d62235a) @@ -95,7 +95,7 @@ Class create M2 Class create X Class create A -mixin {M1 M2 X} -A mixinguard M1 "test" +A mixin guard M1 "test" Class create B -superclass A ? {A info mixin M2} ::M2 ? {A info mixin M*} "::M1 ::M2"