Index: TODO =================================================================== diff -u -r7b8ab056c2dafa49164db2e9ccddd9cb6d5b6fb3 -r7d3bc964348a674a9d80ab8751f1f827dbd6b7b9 --- TODO (.../TODO) (revision 7b8ab056c2dafa49164db2e9ccddd9cb6d5b6fb3) +++ TODO (.../TODO) (revision 7d3bc964348a674a9d80ab8751f1f827dbd6b7b9) @@ -3396,6 +3396,9 @@ * some cleanup in regression tests * added support for calling private methods via -local and filters * extended regression test for private + filters + * removed "-local", "-system" and "-intrinsic" from plain dispatch + (like e.g. "o1 -system method") + * removed flag "-local" from nsf::object::dispatch TODO: - fix interp.test for tcl 8.6 @@ -3404,9 +3407,9 @@ - private: * needed fails since method %s.%s is private ? * maybe let private imply protected - * tests for private + mixins - * tests for object-specific private methods - * flag "-local" in dispatch is maybe confusing + * make sure nsf::dispatch works sufficiently similar to plain dispatch + * make nsf::my and nsf::object::dispatch available in the nx namespace + * document private in migration guide tutorial - nx: * maybe provide a replacement for -attributes, but without the magic variable. Index: generic/nsf.c =================================================================== diff -u -r7b8ab056c2dafa49164db2e9ccddd9cb6d5b6fb3 -r7d3bc964348a674a9d80ab8751f1f827dbd6b7b9 --- generic/nsf.c (.../nsf.c) (revision 7b8ab056c2dafa49164db2e9ccddd9cb6d5b6fb3) +++ generic/nsf.c (.../nsf.c) (revision 7d3bc964348a674a9d80ab8751f1f827dbd6b7b9) @@ -9402,28 +9402,10 @@ methodName = MethodName(methodObj); } else { assert(objc > 1); + shift = 1; cmdObj = objv[0]; methodName = ObjStr(objv[1]); - if (unlikely(*methodName == '-')) { - if (strcmp(methodName + 1, "system") == 0) { - flags |= NSF_CM_SYSTEM_METHOD; - shift = 2; - } else if (strcmp(methodName + 1, "local") == 0) { - flags |= NSF_CM_LOCAL_METHOD; - shift = 2; - } else if (strcmp(methodName + 1, "intrinsic") == 0) { - flags |= NSF_CM_INTRINSIC_METHOD; - shift = 2; - } else { - shift = 1; - } - } else { - shift = 1; - } - if (shift >= objc) { - return NsfPrintError(interp, "no method name specified"); - } - methodObj = objv[shift]; + methodObj = objv[1]; methodName = ObjStr(methodObj); if (FOR_COLON_RESOLVER(methodName)) { return NsfPrintError(interp, "%s: method name '%s' must not start with a colon", @@ -18115,25 +18097,22 @@ {-argName "object" -required 1 -type object} {-argName "-frame" -required 0 -nrargs 1 -type "method|object|default" -default "default"} {-argName "-intrinsic" -required 0 -nrargs 0} - {-argName "-local" -required 0 -nrargs 0} {-argName "-system" -required 0 -nrargs 0} {-argName "command" -required 1 -type tclobj} {-argName "args" -type args} } */ static int NsfObjectDispatchCmd(Tcl_Interp *interp, NsfObject *object, - int withFrame, int withIntrinsic, int withLocal, int withSystem, + int withFrame, int withIntrinsic, int withSystem, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]) { int result; CONST char *methodName = ObjStr(command); /*fprintf(stderr, "Dispatch obj=%s, cmd m='%s'\n", ObjectName(object), methodName);*/ - if ((withIntrinsic && withLocal) - || (withIntrinsic && withSystem) - || (withLocal && withSystem)) { - return NsfPrintError(interp, "flags '-intrinsic', '-local' and '-system' are mutual exclusive"); + if (withIntrinsic && withSystem) { + return NsfPrintError(interp, "flags '-intrinsic' and '-system' are mutual exclusive"); } /* @@ -18155,8 +18134,8 @@ * the command. */ - if (withIntrinsic || withSystem || withLocal) { - return NsfPrintError(interp, "cannot use flag '-intrisic', '-local', or '-system'" + if (withIntrinsic || withSystem) { + return NsfPrintError(interp, "cannot use flag '-intrisic' or '-system'" " with fully qualified method name"); } @@ -18223,7 +18202,6 @@ if (withIntrinsic) {flags |= NSF_CM_INTRINSIC_METHOD;} if (withSystem) {flags |= NSF_CM_SYSTEM_METHOD;} - if (withLocal) {flags |= NSF_CM_LOCAL_METHOD;} if (nobjc >= 1) { arg = nobjv[0]; Index: generic/nsfAPI.decls =================================================================== diff -u -rb2ab5886fc3278e549bb2772dfce921fbd06a9e9 -r7d3bc964348a674a9d80ab8751f1f827dbd6b7b9 --- generic/nsfAPI.decls (.../nsfAPI.decls) (revision b2ab5886fc3278e549bb2772dfce921fbd06a9e9) +++ generic/nsfAPI.decls (.../nsfAPI.decls) (revision 7d3bc964348a674a9d80ab8751f1f827dbd6b7b9) @@ -113,7 +113,6 @@ {-argName "object" -required 1 -type object} {-argName "-frame" -required 0 -type "method|object|default" -default "default"} {-argName "-intrinsic" -required 0 -nrargs 0} - {-argName "-local" -required 0 -nrargs 0} {-argName "-system" -required 0 -nrargs 0} {-argName "command" -required 1 -type tclobj} {-argName "args" -type args} Index: generic/nsfAPI.h =================================================================== diff -u -rb2ab5886fc3278e549bb2772dfce921fbd06a9e9 -r7d3bc964348a674a9d80ab8751f1f827dbd6b7b9 --- generic/nsfAPI.h (.../nsfAPI.h) (revision b2ab5886fc3278e549bb2772dfce921fbd06a9e9) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision 7d3bc964348a674a9d80ab8751f1f827dbd6b7b9) @@ -349,7 +349,7 @@ static int NsfNSCopyCmdsCmd(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int NsfNSCopyVarsCmd(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int NsfNextCmd(Tcl_Interp *interp, Tcl_Obj *arguments); -static int NsfObjectDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, int withIntrinsic, int withLocal, int withSystem, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]); +static int NsfObjectDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, int withIntrinsic, int withSystem, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]); static int NsfObjectExistsCmd(Tcl_Interp *interp, Tcl_Obj *value); static int NsfObjectPropertyCmd(Tcl_Interp *interp, NsfObject *objectName, int objectproperty); static int NsfObjectQualifyCmd(Tcl_Interp *interp, Tcl_Obj *objectName); @@ -1417,12 +1417,11 @@ NsfObject *object = (NsfObject *)pc.clientData[0]; int withFrame = (int )PTR2INT(pc.clientData[1]); int withIntrinsic = (int )PTR2INT(pc.clientData[2]); - int withLocal = (int )PTR2INT(pc.clientData[3]); - int withSystem = (int )PTR2INT(pc.clientData[4]); - Tcl_Obj *command = (Tcl_Obj *)pc.clientData[5]; + int withSystem = (int )PTR2INT(pc.clientData[3]); + Tcl_Obj *command = (Tcl_Obj *)pc.clientData[4]; assert(pc.status == 0); - return NsfObjectDispatchCmd(interp, object, withFrame, withIntrinsic, withLocal, withSystem, command, objc-pc.lastObjc, objv+pc.lastObjc); + return NsfObjectDispatchCmd(interp, object, withFrame, withIntrinsic, withSystem, command, objc-pc.lastObjc, objv+pc.lastObjc); } } @@ -2548,11 +2547,10 @@ {"::nsf::next", NsfNextCmdStub, 1, { {"arguments", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, -{"::nsf::object::dispatch", NsfObjectDispatchCmdStub, 7, { +{"::nsf::object::dispatch", NsfObjectDispatchCmdStub, 6, { {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, {"-frame", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToFrame, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"-intrinsic", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-local", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"-system", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"command", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} Index: tests/interceptor-slot.test =================================================================== diff -u -r3e18b80be2883ba647c2110a2e8e2b1980940c30 -r7d3bc964348a674a9d80ab8751f1f827dbd6b7b9 --- tests/interceptor-slot.test (.../interceptor-slot.test) (revision 3e18b80be2883ba647c2110a2e8e2b1980940c30) +++ tests/interceptor-slot.test (.../interceptor-slot.test) (revision 7d3bc964348a674a9d80ab8751f1f827dbd6b7b9) @@ -294,37 +294,6 @@ ? {c1 [Z info method origin bar]} "Z Y " ? {c1 [Y info method origin bar]} "Y " - # - # check, whether the context of "[self] -local" is correct - # - A public method bar {} {[self] -local foo} - B public method bar {} {[self] -local foo} - C public method bar {} {[self] -local foo} - Y public method bar {} {[self] -local foo} - Z public method bar {} {[self] -local foo} - - ? {c1 bar} "C B A Z Y " - ? {c1 [C info method origin bar]} "C B A Z Y " - ? {c1 [B info method origin bar]} "B A Z Y " - ? {c1 [A info method origin bar]} "A Z Y " - ? {c1 [Z info method origin bar]} "Z Y " - ? {c1 [Y info method origin bar]} "Y " - - # - # check, whether the context of "nsf::object::dispatch [self] -local" is correct - # - A public method bar {} {nsf::object::dispatch [self] -local foo} - B public method bar {} {nsf::object::dispatch [self] -local foo} - C public method bar {} {nsf::object::dispatch [self] -local foo} - Y public method bar {} {nsf::object::dispatch [self] -local foo} - Z public method bar {} {nsf::object::dispatch [self] -local foo} - - ? {c1 bar} "C B A Z Y " - ? {c1 [C info method origin bar]} "C B A Z Y " - ? {c1 [B info method origin bar]} "B A Z Y " - ? {c1 [A info method origin bar]} "A Z Y " - ? {c1 [Z info method origin bar]} "Z Y " - ? {c1 [Y info method origin bar]} "Y " } @@ -346,7 +315,7 @@ } X create c1 ? {c1 foo} "C B A X " - ? {c1 -intrinsic foo} "X " + ? {nsf::object::dispatch c1 -intrinsic foo} "X " # @@ -358,7 +327,7 @@ Z create c1 -mixin {C B A} ? {c1 foo} "C B A Z Y " - ? {c1 -intrinsic foo} "Z Y " + ? {nsf::object::dispatch c1 -intrinsic foo} "Z Y " # # check, whether the context of "my -intrinsic" is correct @@ -378,22 +347,6 @@ ? {c1 [Y info method origin bar]} "Z Y " # - # check, whether the context of "[self] -intrinsic" is correct - # - A public method bar {} {[self] -intrinsic foo} - B public method bar {} {[self] -intrinsic foo} - C public method bar {} {[self] -intrinsic foo} - Y public method bar {} {[self] -intrinsic foo} - Z public method bar {} {[self] -intrinsic foo} - - ? {c1 bar} "Z Y " - ? {c1 [C info method origin bar]} "Z Y " - ? {c1 [B info method origin bar]} "Z Y " - ? {c1 [A info method origin bar]} "Z Y " - ? {c1 [Z info method origin bar]} "Z Y " - ? {c1 [Y info method origin bar]} "Z Y " - - # # check, whether the context of "nsf::object::dispatch [self] -intrinsic" is correct # A public method bar {} {nsf::object::dispatch [self] -intrinsic foo} Index: tests/protected.test =================================================================== diff -u -r7b8ab056c2dafa49164db2e9ccddd9cb6d5b6fb3 -r7d3bc964348a674a9d80ab8751f1f827dbd6b7b9 --- tests/protected.test (.../protected.test) (revision 7b8ab056c2dafa49164db2e9ccddd9cb6d5b6fb3) +++ tests/protected.test (.../protected.test) (revision 7d3bc964348a674a9d80ab8751f1f827dbd6b7b9) @@ -493,17 +493,17 @@ ? {o1 info} "overloads system info" ? {o1 ::nx::Object::slot::__info::vars} "v" ? {o1 [nx::Object info method origin "info vars"]} "v" - ? {o1 -system info vars} "v" + #? {o1 -system info vars} "v" ? {nsf::object::dispatch o1 -system info vars} "v" - ? {o1 -system} "no method name specified" + #? {o1 -system} "no method name specified" ? {o1 method foo {} {return foo}} "overloads method method" - ? {o1 -system public method foo {} {return foo}} "::o1::foo" + ? {nsf::object::dispatch o1 -system public method foo {} {return foo}} "::o1::foo" ? {o1 destroy} "overloads system destroy" ? {nsf::object::exists o1} 1 - ? {o1 -system destroy} "" + ? {nsf::object::dispatch o1 -system destroy} "" ? {nsf::object::exists o1} 0 # @@ -519,12 +519,13 @@ ? {c1 info} "overloads system info" ? {c1 ::nx::Object::slot::__info::vars} "v" ? {c1 [nx::Object info method origin "info vars"]} "v" - ? {c1 -system info vars} "v" + #? {c1 -system info vars} "v" ? {nsf::object::dispatch c1 -system info vars} "v" ? {c1 destroy} "overloads system destroy" ? {nsf::object::exists c1} 1 - ? {c1 -system destroy} "" + #? {c1 -system destroy} "" + ? {nsf::object::dispatch c1 -system destroy} "" ? {nsf::object::exists c1} 0 }