Index: generic/gentclAPI.decls =================================================================== diff -u -rd56d2a8ee3f246c9891783abb09bd820dbc508e4 -rd70c849219212800fa401c2227796b9a63eadcaf --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision d56d2a8ee3f246c9891783abb09bd820dbc508e4) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -85,7 +85,6 @@ } xotclCmd relation XOTclRelationCmd { {-argName "object" -type object} - {-argName "-per-object"} {-argName "relationtype" -required 1 -type "mixin|instmixin|object-mixin|class-mixin|filter|instfilter|object-filter|class-filter|class|superclass|rootclass"} {-argName "value" -required 0 -type tclobj} } @@ -200,15 +199,13 @@ {-argName "args" -required 0 -type args} } classMethod filterguard XOTclCFilterGuardMethod { - {-argName "-per-object" -type switch} {-argName "filter" -required 1} {-argName "guard" -required 1 -type tclobj} } classMethod instinvar XOTclCInvariantsMethod { {-argName "invariantlist" -required 1 -type tclobj} } classMethod mixinguard XOTclCMixinGuardMethod { - {-argName "-per-object" -type switch} {-argName "mixin" -required 1} {-argName "guard" -required 1 -type tclobj} } Index: generic/predefined.h =================================================================== diff -u -r2454ab78913d0686b2ec5feeb401a051dc6a6164 -rd70c849219212800fa401c2227796b9a63eadcaf --- generic/predefined.h (.../predefined.h) (revision 2454ab78913d0686b2ec5feeb401a051dc6a6164) +++ generic/predefined.h (.../predefined.h) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -21,13 +21,11 @@ "::xotcl::methodproperty Class dealloc redefine-protected true\n" "::xotcl::methodproperty Class create redefine-protected true\n" "::xotcl::dispatch Class ::xotcl::cmd::Class::class-method method {\n" -"-per-object:switch\n" "name arguments body -precondition -postcondition} {\n" "set conditions [list]\n" "if {[info exists precondition]} {lappend conditions -precondition $precondition}\n" "if {[info exists postcondition]} {lappend conditions -postcondition $postcondition}\n" -"set cls [expr {${per-object} ? \"Object\" : \"Class\"}]\n" -"::xotcl::dispatch [self] ::xotcl::cmd::${cls}::[string tolower $cls]-method \\\n" +"::xotcl::dispatch [self] ::xotcl::cmd::Class::class-method \\\n" "$name $arguments $body {*}$conditions}\n" "::xotcl::dispatch Object ::xotcl::cmd::Class::class-method method {\n" "name arguments body -precondition -postcondition} {\n" @@ -43,7 +41,10 @@ "if {$what in [list \"info\"]} {\n" "return [::xotcl2::objectInfo [lindex $args 0] [self] {*}[lrange $args 1 end]]}\n" "if {$what in [list \"filter\" \"mixin\"]} {\n" -"return [.object-$what {*}$args]}}\n" +"puts stderr \"call .object-$what {*}$args\"\n" +"return [.object-$what {*}$args]}\n" +"if {$what in [list \"filterguard\" \"mixinguard\"]} {\n" +"return [::xotcl::dispatch [self] ::xotcl::cmd::Object::$what {*}$args]}}\n" ".method unknown {m args} {\n" "error \"Method '$m' unknown for [self].\\\n" "Consider '[self] create $m $args' instead of '[self] $m $args'\"}}\n" @@ -72,10 +73,9 @@ "-per-object \\\n" "{*}[expr {${objscope} ? \"-objscope\" : \"\"}] \\\n" "$cmd}\n" -"Class public method alias {-objscope:switch -per-object:switch methodName cmd} {\n" +"Class public method alias {-objscope:switch methodName cmd} {\n" "::xotcl::alias [self] $methodName \\\n" "{*}[expr {${objscope} ? \"-objscope\" : \"\"}] \\\n" -"{*}[expr {${per-object} ? \"-per-object\" : \"\"}] \\\n" "$cmd}\n" "Object public method setter {methodName value:optional} {\n" "if {[info exists value]} {\n" Index: generic/predefined.xotcl =================================================================== diff -u -r2454ab78913d0686b2ec5feeb401a051dc6a6164 -rd70c849219212800fa401c2227796b9a63eadcaf --- generic/predefined.xotcl (.../predefined.xotcl) (revision 2454ab78913d0686b2ec5feeb401a051dc6a6164) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -50,14 +50,12 @@ # define method "method" for Class and Object ::xotcl::dispatch Class ::xotcl::cmd::Class::class-method method { - -per-object:switch name arguments body -precondition -postcondition } { set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - set cls [expr {${per-object} ? "Object" : "Class"}] - ::xotcl::dispatch [self] ::xotcl::cmd::${cls}::[string tolower $cls]-method \ + ::xotcl::dispatch [self] ::xotcl::cmd::Class::class-method \ $name $arguments $body {*}$conditions } @@ -67,8 +65,6 @@ set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - #puts stderr [subst {::xotcl::dispatch [self] ::xotcl::cmd::Object::object-method \ - # $name $arguments $body {*}$conditions}] ::xotcl::dispatch [self] ::xotcl::cmd::Object::object-method \ $name $arguments $body {*}$conditions } @@ -87,6 +83,9 @@ if {$what in [list "filter" "mixin"]} { return [.object-$what {*}$args] } + if {$what in [list "filterguard" "mixinguard"]} { + return [::xotcl::dispatch [self] ::xotcl::cmd::Object::$what {*}$args] + } } # define unknown handler for class @@ -156,10 +155,9 @@ $cmd } - Class public method alias {-objscope:switch -per-object:switch methodName cmd} { + Class public method alias {-objscope:switch methodName cmd} { ::xotcl::alias [self] $methodName \ {*}[expr {${objscope} ? "-objscope" : ""}] \ - {*}[expr {${per-object} ? "-per-object" : ""}] \ $cmd } Index: generic/tclAPI.h =================================================================== diff -u -rd56d2a8ee3f246c9891783abb09bd820dbc508e4 -rd70c849219212800fa401c2227796b9a63eadcaf --- generic/tclAPI.h (.../tclAPI.h) (revision d56d2a8ee3f246c9891783abb09bd820dbc508e4) +++ generic/tclAPI.h (.../tclAPI.h) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -188,12 +188,12 @@ static int XOTclCAllocMethod(Tcl_Interp *interp, XOTclClass *cl, Tcl_Obj *name); static int XOTclCCreateMethod(Tcl_Interp *interp, XOTclClass *cl, char *name, int objc, Tcl_Obj *CONST objv[]); static int XOTclCDeallocMethod(Tcl_Interp *interp, XOTclClass *cl, Tcl_Obj *object); -static int XOTclCFilterGuardMethod(Tcl_Interp *interp, XOTclClass *cl, int withPer_object, char *filter, Tcl_Obj *guard); +static int XOTclCFilterGuardMethod(Tcl_Interp *interp, XOTclClass *cl, char *filter, Tcl_Obj *guard); static int XOTclCForwardMethod(Tcl_Interp *interp, XOTclClass *cl, Tcl_Obj *name, Tcl_Obj *withDefault, int withEarlybinding, Tcl_Obj *withMethodprefix, int withObjscope, Tcl_Obj *withOnerror, int withVerbose, Tcl_Obj *target, int nobjc, Tcl_Obj *CONST nobjv[]); static int XOTclCInvalidateObjectParameterMethod(Tcl_Interp *interp, XOTclClass *cl); static int XOTclCInvariantsMethod(Tcl_Interp *interp, XOTclClass *cl, Tcl_Obj *invariantlist); static int XOTclCMethodMethod(Tcl_Interp *interp, XOTclClass *cl, int withInner_namespace, int withPublic, Tcl_Obj *name, Tcl_Obj *args, Tcl_Obj *body, Tcl_Obj *withPrecondition, Tcl_Obj *withPostcondition); -static int XOTclCMixinGuardMethod(Tcl_Interp *interp, XOTclClass *cl, int withPer_object, char *mixin, Tcl_Obj *guard); +static int XOTclCMixinGuardMethod(Tcl_Interp *interp, XOTclClass *cl, char *mixin, Tcl_Obj *guard); static int XOTclCNewMethod(Tcl_Interp *interp, XOTclClass *cl, XOTclObject *withChildof, int nobjc, Tcl_Obj *CONST nobjv[]); static int XOTclCRecreateMethod(Tcl_Interp *interp, XOTclClass *cl, Tcl_Obj *name, int objc, Tcl_Obj *CONST objv[]); static int XOTclClassInfoFilterMethod(Tcl_Interp *interp, XOTclClass *class, int withGuards, char *pattern); @@ -266,7 +266,7 @@ static int XOTclNSCopyCmds(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int XOTclNSCopyVars(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int XOTclQualifyObjCmd(Tcl_Interp *interp, Tcl_Obj *name); -static int XOTclRelationCmd(Tcl_Interp *interp, XOTclObject *object, int withPer_object, int relationtype, Tcl_Obj *value); +static int XOTclRelationCmd(Tcl_Interp *interp, XOTclObject *object, int relationtype, Tcl_Obj *value); static int XOTclSetInstvarCmd(Tcl_Interp *interp, XOTclObject *object, Tcl_Obj *variable, Tcl_Obj *value); static int XOTclSetterCmd(Tcl_Interp *interp, XOTclObject *object, char *methodName, int withPer_object); @@ -466,12 +466,11 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - int withPer_object = (int )pc.clientData[0]; - char *filter = (char *)pc.clientData[1]; - Tcl_Obj *guard = (Tcl_Obj *)pc.clientData[2]; + char *filter = (char *)pc.clientData[0]; + Tcl_Obj *guard = (Tcl_Obj *)pc.clientData[1]; parseContextRelease(&pc); - return XOTclCFilterGuardMethod(interp, cl, withPer_object, filter, guard); + return XOTclCFilterGuardMethod(interp, cl, filter, guard); } } @@ -576,12 +575,11 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - int withPer_object = (int )pc.clientData[0]; - char *mixin = (char *)pc.clientData[1]; - Tcl_Obj *guard = (Tcl_Obj *)pc.clientData[2]; + char *mixin = (char *)pc.clientData[0]; + Tcl_Obj *guard = (Tcl_Obj *)pc.clientData[1]; parseContextRelease(&pc); - return XOTclCMixinGuardMethod(interp, cl, withPer_object, mixin, guard); + return XOTclCMixinGuardMethod(interp, cl, mixin, guard); } } @@ -2028,12 +2026,11 @@ return TCL_ERROR; } else { XOTclObject *object = (XOTclObject *)pc.clientData[0]; - int withPer_object = (int )pc.clientData[1]; - int relationtype = (int )pc.clientData[2]; - Tcl_Obj *value = (Tcl_Obj *)pc.clientData[3]; + int relationtype = (int )pc.clientData[1]; + Tcl_Obj *value = (Tcl_Obj *)pc.clientData[2]; parseContextRelease(&pc); - return XOTclRelationCmd(interp, object, withPer_object, relationtype, value); + return XOTclRelationCmd(interp, object, relationtype, value); } } @@ -2097,8 +2094,7 @@ {"::xotcl::cmd::Class::dealloc", XOTclCDeallocMethodStub, 1, { {"object", 1, 0, convertToTclobj}} }, -{"::xotcl::cmd::Class::filterguard", XOTclCFilterGuardMethodStub, 3, { - {"-per-object", 0, 0, convertToBoolean}, +{"::xotcl::cmd::Class::filterguard", XOTclCFilterGuardMethodStub, 2, { {"filter", 1, 0, convertToString}, {"guard", 1, 0, convertToTclobj}} }, @@ -2128,8 +2124,7 @@ {"-precondition", 0, 1, convertToTclobj}, {"-postcondition", 0, 1, convertToTclobj}} }, -{"::xotcl::cmd::Class::mixinguard", XOTclCMixinGuardMethodStub, 3, { - {"-per-object", 0, 0, convertToBoolean}, +{"::xotcl::cmd::Class::mixinguard", XOTclCMixinGuardMethodStub, 2, { {"mixin", 1, 0, convertToString}, {"guard", 1, 0, convertToTclobj}} }, @@ -2447,9 +2442,8 @@ {"::xotcl::__qualify", XOTclQualifyObjCmdStub, 1, { {"name", 1, 0, convertToTclobj}} }, -{"::xotcl::relation", XOTclRelationCmdStub, 4, { +{"::xotcl::relation", XOTclRelationCmdStub, 3, { {"object", 0, 0, convertToObject}, - {"-per-object", 0, 0, convertToString}, {"relationtype", 1, 0, convertToRelationtype}, {"value", 0, 0, convertToTclobj}} }, Index: generic/xotcl.c =================================================================== diff -u -r9abb79a3baac4437fc9075422cadbeae8702a803 -rd70c849219212800fa401c2227796b9a63eadcaf --- generic/xotcl.c (.../xotcl.c) (revision 9abb79a3baac4437fc9075422cadbeae8702a803) +++ generic/xotcl.c (.../xotcl.c) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -9630,10 +9630,10 @@ XOTclObject *object, char *methodName, Tcl_Command cmd, int withObjscope, int withPer_object) { Tcl_ListObjAppendElement(interp, listObj, object->cmdName); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewStringObj(registerCmdName,-1)); if (withPer_object) { - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewStringObj("-per-object",-1)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewStringObj("object",-1)); } + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewStringObj(registerCmdName,-1)); if (withObjscope) { Tcl_ListObjAppendElement(interp, listObj, Tcl_NewStringObj("-objscope",-1)); } @@ -9661,12 +9661,15 @@ Tcl_SetObjResult(interp, XOTclGlobalObjects[XOTE_EMPTY]); } else { Tcl_ObjCmdProc *procPtr = Tcl_Command_objProc(cmd); - /*Tcl_Command importedCmd = GetOriginalCommand(cmd);*/ - /* Tcl_ObjCmdProc *resolvedProc = Tcl_Command_objProc(importedCmd);*/ + int outputPerObject = 0; Tcl_Obj *resultObj; if (!XOTclObjectIsClass(object)) { withPer_object = 1; + /* don't output "object" modifier, if object is not a class */ + outputPerObject = 0; + } else { + outputPerObject = withPer_object; } switch (subcmd) { @@ -9728,8 +9731,6 @@ case InfomethodsubcmdDefinitionIdx: { XOTclAssertionStore *assertions; - /* don't output -per-object, if object is not a class */ - int outputPerObject = XOTclObjectIsClass(object) ? withPer_object : 0; resultObj = Tcl_NewListObj(0, NULL); /* todo: don't hard-code registering command name "method" */ @@ -9773,7 +9774,7 @@ resultObj = Tcl_NewListObj(0, NULL); /* todo: don't hard-code registering command name "forward" */ AppendMethodRegistration(interp, resultObj, "forward", object, methodName, cmd, - 0, withPer_object); + 0, outputPerObject); AppendForwardDefinition(interp, resultObj, clientData); Tcl_SetObjResult(interp, resultObj); break; @@ -9791,7 +9792,7 @@ resultObj = Tcl_NewListObj(0, NULL); /* todo: don't hard-code registering command name "setter" */ AppendMethodRegistration(interp, resultObj, "setter", object, methodName, cmd, - 0, withPer_object); + 0, outputPerObject); Tcl_SetObjResult(interp, resultObj); break; } @@ -9813,7 +9814,7 @@ /* todo: don't hard-code registering command name "alias" */ AppendMethodRegistration(interp, resultObj, "alias", object, methodName, cmd, - nrElements!=1, withPer_object); + nrElements!=1, outputPerObject); Tcl_ListObjAppendElement(interp, resultObj, listElements[nrElements-1]); Tcl_SetObjResult(interp, resultObj); break; @@ -11053,7 +11054,7 @@ } static int XOTclRelationCmd(Tcl_Interp *interp, XOTclObject *object, - int withPer_object, int relationtype, Tcl_Obj *value) { + int relationtype, Tcl_Obj *value) { int oc; Tcl_Obj **ov; XOTclObject *nobj = NULL; XOTclClass *cl = NULL; @@ -11064,43 +11065,18 @@ /*fprintf(stderr, "XOTclRelationCmd %s %d rel=%d val='%s'\n", objectName(object),withPer_object,relationtype,value?ObjStr(value):"NULL");*/ /* set withPer_object according to object- or class- */ - switch (relationtype) { - case RelationtypeObject_mixinIdx: withPer_object = 1; break; - case RelationtypeObject_filterIdx: withPer_object = 1; break; - case RelationtypeClass_mixinIdx: withPer_object = 0; break; - case RelationtypeClass_filterIdx: withPer_object = 0; break; - } - if (withPer_object) { - switch (relationtype) { - case RelationtypeClass_mixinIdx: - case RelationtypeInstmixinIdx: - relationtype = RelationtypeObject_mixinIdx; - break; - case RelationtypeClass_filterIdx: - case RelationtypeInstfilterIdx: - relationtype = RelationtypeObject_filterIdx; - break; + switch (relationtype) { + case RelationtypeMixinIdx: + if (XOTclObjectIsClass(object)) { + relationtype = RelationtypeClass_mixinIdx; } - } else { - switch (relationtype) { - case RelationtypeObject_mixinIdx: - case RelationtypeMixinIdx: - if ( - XOTclObjectIsClass(object) - ) { - relationtype = RelationtypeClass_mixinIdx; - } - break; - case RelationtypeObject_filterIdx: - case RelationtypeFilterIdx: - if ( - XOTclObjectIsClass(object) - ) { - /*relationtype = RelationtypeClass_filterIdx;*/ - } - break; + break; + case RelationtypeFilterIdx: + if (XOTclObjectIsClass(object)) { + relationtype = RelationtypeClass_filterIdx; } + break; } switch (relationtype) { @@ -11697,7 +11673,7 @@ int relIdx; result = convertToRelationtype(interp, paramPtr->nameObj, paramPtr, (ClientData)&relIdx); if (result == TCL_OK) { - result = XOTclRelationCmd(interp, obj, 0 /*fixme*/, relIdx, newValue); + result = XOTclRelationCmd(interp, obj, relIdx, newValue); } if (result != TCL_OK) { XOTcl_PopFrame(interp, obj); @@ -12397,13 +12373,9 @@ } static int XOTclCFilterGuardMethod(Tcl_Interp *interp, XOTclClass *cl, - int withPer_object, char *filter, Tcl_Obj *guard) { + char *filter, Tcl_Obj *guard) { XOTclClassOpt *opt = cl->opt; - if (withPer_object) { - return XOTclOFilterGuardMethod(interp, &cl->object, filter, guard); - } - if (opt && opt->instfilters) { XOTclCmdList *h = CmdListFindNameInList(interp, filter, opt->instfilters); if (h) { @@ -12431,22 +12403,17 @@ return TCL_OK; } -static int XOTclCMixinGuardMethod(Tcl_Interp *interp, XOTclClass *cl, int withPer_object, char *mixin, Tcl_Obj *guard) { +static int XOTclCMixinGuardMethod(Tcl_Interp *interp, XOTclClass *cl, char *mixin, Tcl_Obj *guard) { XOTclClassOpt *opt = cl->opt; - XOTclCmdList *h; - if (withPer_object) { - return XOTclOMixinGuardMethod(interp, &cl->object, mixin, guard); - } - if (opt && opt->instmixins) { XOTclClass *mixinCl = XOTclpGetClass(interp, mixin); Tcl_Command mixinCmd = NULL; if (mixinCl) { mixinCmd = Tcl_GetCommandFromObj(interp, mixinCl->object.cmdName); } if (mixinCmd) { - h = CmdListFindCmdInList(mixinCmd, opt->instmixins); + XOTclCmdList *h = CmdListFindCmdInList(mixinCmd, opt->instmixins); if (h) { if (h->clientData) GuardDel((XOTclCmdList*) h); Index: library/lib/xotcl1.xotcl =================================================================== diff -u -r2454ab78913d0686b2ec5feeb401a051dc6a6164 -rd70c849219212800fa401c2227796b9a63eadcaf --- library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision 2454ab78913d0686b2ec5feeb401a051dc6a6164) +++ library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -375,25 +375,24 @@ Object instproc ismixin {class} {::xotcl::is [self] mixin $class} Object instproc istype {class} {::xotcl::is [self] type $class} - ::xotcl::alias Object parametercmd ::xotcl::classes::xotcl2::Object::setter ::xotcl::alias Object contains ::xotcl::classes::xotcl2::Object::contains - ::xotcl::Class forward slots %self contains \ -object {%::xotcl::dispatch [::xotcl::self] -objscope ::subst [::xotcl::self]::slot} # - # define forward and instforward in terms of forward - # define parametercmd and instparametercmd in terms of setter - # define parametercmd and instparametercmd in terms of setter + # define parametercmd and instparametercmd in terms of ::xotcl2 method setter + # define filterguard and instfilterguard in terms of filterguard # define mixinguard and instmixinguard in terms of mixinguard # + ::xotcl::alias Object parametercmd ::xotcl::classes::xotcl2::Object::setter ::xotcl::alias Class instparametercmd ::xotcl::classes::xotcl2::Class::setter - #::xotcl::alias Class parametercmd ::xotcl::cmd::Object::setter + ::xotcl::alias Class filterguard ::xotcl::cmd::Object::filterguard ::xotcl::alias Class instfilterguard ::xotcl::cmd::Class::filterguard + ::xotcl::alias Class mixinguard ::xotcl::cmd::Object::mixinguard ::xotcl::alias Class instmixinguard ::xotcl::cmd::Class::mixinguard - ::xotcl::alias Class mixinguard ::xotcl::cmd::Object::mixinguard + # define forward and instforward in terms of forward # we are changing the the semantics from forward -> instforward, # this has to be done at the end to avoid confusion with the # previous forward invocation in this script. @@ -420,12 +419,16 @@ Object instproc procsearch {name} { set definition [::xotcl::cmd::ObjectInfo::callable [self] -which $name] if {$definition ne ""} { - foreach {obj kind arg} $definition break - set perClass [expr {[::xotcl::is $obj class] && $arg ne "-per-object"}] + foreach {obj modifier kind} $definition break + if {$modifier ne "object"} { + set kind $modifier + set perClass [::xotcl::is $obj class] + } else { + set perClass 0 + } switch $kind { alias {if {$perClass} {set kind "instcmd"} else {set kind "cmd"}} forward {if {$perClass} {set kind "instforward"}} - mixin {if {$perClass} {set kind "instmixin"}} method {if {$perClass} {set kind "instproc"} else {set kind "proc"}} setter {if {$perClass} {set kind "instparametercmd"} else {set kind "parametercmd"}} default {error "not handeled: $definition"} Index: tests/aliastest.xotcl =================================================================== diff -u -rd56d2a8ee3f246c9891783abb09bd820dbc508e4 -rd70c849219212800fa401c2227796b9a63eadcaf --- tests/aliastest.xotcl (.../aliastest.xotcl) (revision d56d2a8ee3f246c9891783abb09bd820dbc508e4) +++ tests/aliastest.xotcl (.../aliastest.xotcl) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -106,21 +106,21 @@ ? {T info methods -methodtype scripted} {} T method foo args { return [self class]->[self proc] } -T method -per-object bar args { return [self class]->[self proc] } +T object method bar args { return [self class]->[self proc] } ::xotcl::alias T FOO -per-object ::xotcl::classes::T::foo ::xotcl::alias T BAR -per-object ::T::FOO ::xotcl::alias T ZAP -per-object ::T::BAR ? {T info methods -methodtype scripted} {foo} ? {lsort [T object info methods -methodtype alias]} {BAR FOO ZAP} ? {lsort [T object info methods -methodtype scripted]} {BAR FOO ZAP bar} ? {t foo} ::T->foo -? {T object info method definition ZAP} {::T alias -per-object ZAP ::T::BAR} +? {T object info method definition ZAP} {::T object alias ZAP ::T::BAR} ? {T FOO} ->foo ? {T BAR} ->foo ? {T ZAP} ->foo ? {T bar} ->bar -T method -per-object FOO {} {} +T object method FOO {} {} ? {T info methods -methodtype scripted} {foo} ? {lsort [T object info methods -methodtype scripted]} {BAR ZAP bar} ? {T BAR} ->foo @@ -130,7 +130,7 @@ ? {lsort [T object info methods -methodtype scripted]} {ZAP bar} #? {T BAR} ""; # now calling the proc defined above, alias chain seems intact ? {T ZAP} ->foo; # is ok, still pointing to 'foo' -#T method -per-object BAR {} {} +#T object method BAR {} {} ? {T info methods -methodtype scripted} {foo} ? {lsort [T object info methods -methodtype scripted]} {ZAP bar} ? {T ZAP} ->foo @@ -141,18 +141,18 @@ # # per-object methods as per-object aliases # -T method -per-object m1 args { return [self class]->[self proc] } +T object method m1 args { return [self class]->[self proc] } ::xotcl::alias T M1 -per-object ::T::m1 ::xotcl::alias T M11 -per-object ::T::M1 ? {lsort [T object info methods -methodtype scripted]} {M1 M11 bar m1} ? {T m1} ->m1 ? {T M1} ->m1 ? {T M11} ->m1 -T method -per-object M1 {} {} +T object method M1 {} {} ? {lsort [T object info methods -methodtype scripted]} {M11 bar m1} ? {T m1} ->m1 ? {T M11} ->m1 -T method -per-object m1 {} {} +T object method m1 {} {} ? {lsort [T object info methods -methodtype scripted]} {bar} # @@ -203,12 +203,12 @@ Class create U U create u ? {namespace exists ::U} 0 -U method -per-object zap args { return [self class]->[self proc] } +U object method zap args { return [self class]->[self proc] } ::xotcl::alias ::U ZAP -per-object ::U::zap U requireNamespace ? {namespace exists ::U} 1 -U method -per-object bar args { return [self class]->[self proc] } +U object method bar args { return [self class]->[self proc] } ::xotcl::alias U BAR -per-object ::U::bar ? {lsort [U object info methods -methodtype scripted]} {BAR ZAP bar zap} ? {U BAR} ->bar @@ -232,7 +232,7 @@ } V method bar {z} { return $z } -V method -per-object bar {z} { return $z } +V object method bar {z} { return $z } proc foo args { return [.bar ${.z}]-[set .z]-[my bar [set .z]] } @@ -277,13 +277,13 @@ ? {info exists ::xotcl::alias(::C,FOO,0)} 1 ? {array get ::xotcl::alias ::o,FOO,1} "::o,FOO,1 ::foo" ? {array get ::xotcl::alias ::C,FOO,0} "::C,FOO,0 ::foo" -? {o info method definition FOO} "::o alias -per-object FOO ::foo" +? {o info method definition FOO} "::o alias FOO ::foo" ? {C info method definition FOO} "::C alias FOO ::foo" ::xotcl::alias o FOO ::o::bar ? {info exists ::xotcl::alias(::o,FOO,1)} 1 ? {array get ::xotcl::alias ::o,FOO,1} "::o,FOO,1 ::o::bar" -? {o info method definition FOO} "::o alias -per-object FOO ::o::bar" +? {o info method definition FOO} "::o alias FOO ::o::bar" # AliasDelete in XOTclRemovePMethod o method FOO {} {} Index: tests/info-method.xotcl =================================================================== diff -u -rd56d2a8ee3f246c9891783abb09bd820dbc508e4 -rd70c849219212800fa401c2227796b9a63eadcaf --- tests/info-method.xotcl (.../info-method.xotcl) (revision d56d2a8ee3f246c9891783abb09bd820dbc508e4) +++ tests/info-method.xotcl (.../info-method.xotcl) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -20,7 +20,7 @@ Class create C { .method m {x} {return proc-[self proc]} - .method -per-object mpo {} {return instproc-[self proc]} + .object method mpo {} {return instproc-[self proc]} .method m-with-assertions {} {return proc-[self proc]} -precondition 1 -postcondition 2 .forward addOne expr 1 + @@ -54,23 +54,23 @@ ? {C info method definition m} {::C method m x {return proc-[self proc]}} ? {C info method def m} {::C method m x {return proc-[self proc]}} -? {C object info method definition mpo} {::C method -per-object mpo {} {return instproc-[self proc]}} +? {C object info method definition mpo} {::C object method mpo {} {return instproc-[self proc]}} ? {C info method definition m-with-assertions} \ {::C method m-with-assertions {} {return proc-[self proc]} -precondition 1 -postcondition 2} ? {C info method parameter m} {x} ? {Class info method parameter method} \ - {{-per-object:switch 0} name arguments body -precondition -postcondition} + {name arguments body -precondition -postcondition} ? {Object info method parameter alias} \ {{-objscope:switch 0} methodName cmd} # raises currently an error ? {catch {C info method parameter a}} 1 ? {C info method definition addOne} "::C forward addOne expr 1 +" -? {C object info method definition add1} "::C forward -per-object add1 expr 1 +" -? {C object info method definition fpo} "::C forward -per-object fpo ::o" +? {C object info method definition add1} "::C object forward add1 expr 1 +" +? {C object info method definition fpo} "::C object forward fpo ::o" ? {C info method definition s} "::C setter s" -? {C object info method definition spo} "::C setter -per-object spo" +? {C object info method definition spo} "::C object setter spo" ? {C info method definition a} "::C alias a ::set" -? {C object info method definition apo} "::C alias -per-object apo ::puts" +? {C object info method definition apo} "::C object alias apo ::puts" Index: tests/interceptor-slot.xotcl =================================================================== diff -u -r2454ab78913d0686b2ec5feeb401a051dc6a6164 -rd70c849219212800fa401c2227796b9a63eadcaf --- tests/interceptor-slot.xotcl (.../interceptor-slot.xotcl) (revision 2454ab78913d0686b2ec5feeb401a051dc6a6164) +++ tests/interceptor-slot.xotcl (.../interceptor-slot.xotcl) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -54,11 +54,11 @@ # adding, removing per-object mixins for classes through relation # "mixin" and "-per-object" (deprecated) # -::xotcl::relation C -per-object mixin M -? {C info precedence} "::M ::xotcl2::Class ::xotcl2::Object" -? {C object info mixin} "::M" -::xotcl::relation C -per-object mixin "" -? {C info precedence} "::xotcl2::Class ::xotcl2::Object" +# ::xotcl::relation C -per-object mixin M +# ? {C info precedence} "::M ::xotcl2::Class ::xotcl2::Object" +# ? {C object info mixin} "::M" +# ::xotcl::relation C -per-object mixin "" +# ? {C info precedence} "::xotcl2::Class ::xotcl2::Object" # # adding, removing per-object mixins for classes through relation @@ -144,4 +144,4 @@ puts stderr ===class-create+add-via-parameter Class O -mixin M1 puts stderr ====[O info class] -? {O info precedence} "::M1 ::xotcl::Class ::xotcl::Object" \ No newline at end of file +? {O info precedence} "::M1 ::xotcl::Class ::xotcl::Object" Index: tests/method-modifiers.xotcl =================================================================== diff -u -rd56d2a8ee3f246c9891783abb09bd820dbc508e4 -rd70c849219212800fa401c2227796b9a63eadcaf --- tests/method-modifiers.xotcl (.../method-modifiers.xotcl) (revision d56d2a8ee3f246c9891783abb09bd820dbc508e4) +++ tests/method-modifiers.xotcl (.../method-modifiers.xotcl) (revision d70c849219212800fa401c2227796b9a63eadcaf) @@ -161,3 +161,37 @@ ? {lsort [C object info methods]} \ "plain_object_alias plain_object_forward plain_object_method plain_object_setter public_object_alias public_object_forward public_object_method public_object_setter s3" +C destroy + +Class create C +Class create M + +# 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 +C mixin M +C mixinguard M {1 == 1} +? {C info mixinguard M} "1 == 1" +C mixinguard M {} +? {C info mixinguard M} "" + +# now the same as object mixin and object mixin guard +C object mixin M +puts M=[C object info mixin] +C object mixinguard M {1 == 1} +? {C object info mixinguard M} "1 == 1" +C object mixinguard M {} +? {C object info mixinguard M} "" + + +# add an object and class mixin via object-parameter and via slots +Class create M1; Class create M2; Class create M3; Class create M4 +Class create C -mixin M1 -object-mixin M2 { + .mixin add M3 + .object mixin add M4 +} + +? {lsort [C object info mixin]} "::M2 ::M4" +? {lsort [C info mixin]} "::M1 ::M3" \ No newline at end of file