Index: TODO =================================================================== diff -u -r98bfbbfaad78cab360b8db446ad40613c6d421aa -rcafecba5f922de5329a5db109b697cbf88ae5f1a --- TODO (.../TODO) (revision 98bfbbfaad78cab360b8db446ad40613c6d421aa) +++ TODO (.../TODO) (revision cafecba5f922de5329a5db109b697cbf88ae5f1a) @@ -5163,20 +5163,11 @@ ======================================================================== TODO: -- Minor redundancy: "/obj/ info object filter" methods plus "-order" - switch is functionally equivalent to "/obj/ info lookup - filters". Suggestions: Remove -order switch param from the former - (not expected from the provider perspective, we are just interested - in the filters defined on the given obj in isolation). - - the same holds for "/obj/ info object mixin classes -heritage" and - /obj/ info lookup mixins. I suggest, removing "-heritage" from the - former. - - (besides, in nsf.c the respective sections are full code clones) - - TODO: update tutorial and migration guide +- what should happen with: "/class/ info mixin classes -heritage" +- asymmetry between "/obj/ info lookup mixins" vs. "/obj/ info ?object? mixin classes" + - finish nx-property reform (merge into master) - check deactivated tests in tests/serialize.test Index: generic/nsf.c =================================================================== diff -u -rd37c9ae77ae39b7a9a123893daf52195de41dfd1 -rcafecba5f922de5329a5db109b697cbf88ae5f1a --- generic/nsf.c (.../nsf.c) (revision d37c9ae77ae39b7a9a123893daf52195de41dfd1) +++ generic/nsf.c (.../nsf.c) (revision cafecba5f922de5329a5db109b697cbf88ae5f1a) @@ -28052,26 +28052,18 @@ /* objectInfoMethod filtermethods NsfObjInfoFiltermethodsMethod { - {-argName "-guards"} - {-argName "-order"} + {-argName "-guards" -nrargs 0 -type switch} {-argName "pattern"} } */ static int -NsfObjInfoFiltermethodsMethod(Tcl_Interp *interp, NsfObject *object, - int withGuards, int withOrder, - CONST char *pattern) { +NsfObjInfoFiltermethodsMethod(Tcl_Interp *interp, NsfObject *object, int withGuards, + CONST char *pattern) { NsfObjectOpt *opt = object->opt; assert(interp); assert(object); - if (withOrder) { - if (!(object->flags & NSF_FILTER_ORDER_VALID)) { - FilterComputeDefined(interp, object); - } - return FilterInfo(interp, object->filterOrder, pattern, withGuards, 1); - } return opt ? FilterInfo(interp, opt->objFilters, pattern, withGuards, 0) : TCL_OK; } @@ -28514,24 +28506,16 @@ /* objectInfoMethod mixinclasses NsfObjInfoMixinclassesMethod { - {-argName "-guards"} - {-argName "-heritage"} + {-argName "-guards" -nrargs 0 -type switch} {-argName "pattern" -type objpattern} } */ static int -NsfObjInfoMixinclassesMethod(Tcl_Interp *interp, NsfObject *object, - int withGuards, int withHeritage, +NsfObjInfoMixinclassesMethod(Tcl_Interp *interp, NsfObject *object, int withGuards, CONST char *patternString, NsfObject *patternObj) { assert(interp); assert(object); - if (withHeritage) { - if (!(object->flags & NSF_MIXIN_ORDER_VALID)) { - MixinComputeDefined(interp, object); - } - return MixinInfo(interp, object->mixinOrder, patternString, withGuards, patternObj); - } return object->opt ? MixinInfo(interp, object->opt->objMixins, patternString, withGuards, patternObj) : TCL_OK; Index: generic/nsfAPI.decls =================================================================== diff -u -r994c14a5b0e1d662fc4f903f097ed0ee7a130986 -rcafecba5f922de5329a5db109b697cbf88ae5f1a --- generic/nsfAPI.decls (.../nsfAPI.decls) (revision 994c14a5b0e1d662fc4f903f097ed0ee7a130986) +++ generic/nsfAPI.decls (.../nsfAPI.decls) (revision cafecba5f922de5329a5db109b697cbf88ae5f1a) @@ -393,7 +393,6 @@ } objectInfoMethod filtermethods NsfObjInfoFiltermethodsMethod { {-argName "-guards" -nrargs 0 -type switch} - {-argName "-order" -nrargs 0 -type switch} {-argName "pattern"} } objectInfoMethod forward NsfObjInfoForwardMethod { @@ -452,7 +451,6 @@ objectInfoMethod mixinclasses NsfObjInfoMixinclassesMethod { {-argName "-guards" -nrargs 0 -type switch} - {-argName "-heritage" -nrargs 0 -type switch} {-argName "pattern" -type objpattern} } objectInfoMethod mixinguard NsfObjInfoMixinguardMethod { Index: generic/nsfAPI.h =================================================================== diff -u -r994c14a5b0e1d662fc4f903f097ed0ee7a130986 -rcafecba5f922de5329a5db109b697cbf88ae5f1a --- generic/nsfAPI.h (.../nsfAPI.h) (revision 994c14a5b0e1d662fc4f903f097ed0ee7a130986) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision cafecba5f922de5329a5db109b697cbf88ae5f1a) @@ -682,7 +682,7 @@ NSF_nonnull(1) NSF_nonnull(2); static int NsfObjInfoFilterguardMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *filter) NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3); -static int NsfObjInfoFiltermethodsMethod(Tcl_Interp *interp, NsfObject *obj, int withGuards, int withOrder, CONST char *pattern) +static int NsfObjInfoFiltermethodsMethod(Tcl_Interp *interp, NsfObject *obj, int withGuards, CONST char *pattern) NSF_nonnull(1) NSF_nonnull(2); static int NsfObjInfoForwardMethod(Tcl_Interp *interp, NsfObject *obj, int withDefinition, CONST char *name) NSF_nonnull(1) NSF_nonnull(2); @@ -710,7 +710,7 @@ NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(4); static int NsfObjInfoMethodsMethod(Tcl_Interp *interp, NsfObject *obj, int withCallprotection, int withType, int withPath, CONST char *pattern) NSF_nonnull(1) NSF_nonnull(2); -static int NsfObjInfoMixinclassesMethod(Tcl_Interp *interp, NsfObject *obj, int withGuards, int withHeritage, CONST char *patternString, NsfObject *patternObject) +static int NsfObjInfoMixinclassesMethod(Tcl_Interp *interp, NsfObject *obj, int withGuards, CONST char *patternString, NsfObject *patternObject) NSF_nonnull(1) NSF_nonnull(2); static int NsfObjInfoMixinguardMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *mixin) NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3); @@ -2668,11 +2668,10 @@ method_definitions[NsfObjInfoFiltermethodsMethodIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN, &pc) == TCL_OK)) { int withGuards = (int )PTR2INT(pc.clientData[0]); - int withOrder = (int )PTR2INT(pc.clientData[1]); - CONST char *pattern = (CONST char *)pc.clientData[2]; + CONST char *pattern = (CONST char *)pc.clientData[1]; assert(pc.status == 0); - return NsfObjInfoFiltermethodsMethod(interp, obj, withGuards, withOrder, pattern); + return NsfObjInfoFiltermethodsMethod(interp, obj, withGuards, pattern); } else { return TCL_ERROR; @@ -3001,21 +3000,20 @@ method_definitions[NsfObjInfoMixinclassesMethodIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN, &pc) == TCL_OK)) { int withGuards = (int )PTR2INT(pc.clientData[0]); - int withHeritage = (int )PTR2INT(pc.clientData[1]); CONST char *patternString = NULL; NsfObject *patternObject = NULL; - Tcl_Obj *pattern = (Tcl_Obj *)pc.clientData[2]; + Tcl_Obj *pattern = (Tcl_Obj *)pc.clientData[1]; int returnCode; - if (GetMatchObject(interp, pattern, objc>2 ? objv[2] : NULL, &patternObject, &patternString) == -1) { + if (GetMatchObject(interp, pattern, objc>1 ? objv[1] : NULL, &patternObject, &patternString) == -1) { if (pattern) { DECR_REF_COUNT2("patternObj", pattern); } return TCL_OK; } assert(pc.status == 0); - returnCode = NsfObjInfoMixinclassesMethod(interp, obj, withGuards, withHeritage, patternString, patternObject); + returnCode = NsfObjInfoMixinclassesMethod(interp, obj, withGuards, patternString, patternObject); if (pattern) { DECR_REF_COUNT2("patternObj", pattern); @@ -3557,9 +3555,8 @@ {"::nsf::methods::object::info::filterguard", NsfObjInfoFilterguardMethodStub, 1, { {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, -{"::nsf::methods::object::info::filtermethods", NsfObjInfoFiltermethodsMethodStub, 3, { +{"::nsf::methods::object::info::filtermethods", NsfObjInfoFiltermethodsMethodStub, 2, { {"-guards", 0, 0, Nsf_ConvertTo_Boolean, NULL,NULL,"switch",NULL,NULL,NULL,NULL,NULL}, - {"-order", 0, 0, Nsf_ConvertTo_Boolean, NULL,NULL,"switch",NULL,NULL,NULL,NULL,NULL}, {"pattern", 0, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::forward", NsfObjInfoForwardMethodStub, 2, { @@ -3616,9 +3613,8 @@ {"-path", 0, 0, Nsf_ConvertTo_Boolean, NULL,NULL,"switch",NULL,NULL,NULL,NULL,NULL}, {"pattern", 0, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, -{"::nsf::methods::object::info::mixinclasses", NsfObjInfoMixinclassesMethodStub, 3, { +{"::nsf::methods::object::info::mixinclasses", NsfObjInfoMixinclassesMethodStub, 2, { {"-guards", 0, 0, Nsf_ConvertTo_Boolean, NULL,NULL,"switch",NULL,NULL,NULL,NULL,NULL}, - {"-heritage", 0, 0, Nsf_ConvertTo_Boolean, NULL,NULL,"switch",NULL,NULL,NULL,NULL,NULL}, {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,"objpattern",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::mixinguard", NsfObjInfoMixinguardMethodStub, 1, { Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -rf671281a240219965d436e2bfa762baf85274ca6 -rcafecba5f922de5329a5db109b697cbf88ae5f1a --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision f671281a240219965d436e2bfa762baf85274ca6) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision cafecba5f922de5329a5db109b697cbf88ae5f1a) @@ -674,7 +674,7 @@ set patternArg [expr {[info exists pattern] ? [list $pattern] : ""}] if {$order && !$guards} { set def [::nsf::directdispatch [::nsf::current object] \ - ::nsf::methods::object::info::filtermethods -order \ + ::nsf::methods::object::info::lookupfilters \ {*}$guardsFlag \ {*}$patternArg] set def [method_handles_to_xotcl $def] @@ -715,8 +715,11 @@ } :proc mixin {-order:switch -guards:switch pattern:optional} { - set cmd ::nsf::methods::object::info::mixinclasses - if {$order} {lappend cmd "-heritage"} + if {$order} { + set cmd ::nsf::methods::object::info::lookupmixins + } else { + set cmd ::nsf::methods::object::info::mixinclasses + } if {$guards} {lappend cmd "-guards"} if {[info exists pattern]} {lappend cmd $pattern} my {*}$cmd @@ -1457,3 +1460,9 @@ puts stderr "======= XOTcl $::xotcl::version$::xotcl::patchlevel loaded" } +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: tests/info-method.test =================================================================== diff -u -r0e4ebdb092c8158987489b5c26cf11526b2756f5 -rcafecba5f922de5329a5db109b697cbf88ae5f1a --- tests/info-method.test (.../info-method.test) (revision 0e4ebdb092c8158987489b5c26cf11526b2756f5) +++ tests/info-method.test (.../info-method.test) (revision cafecba5f922de5329a5db109b697cbf88ae5f1a) @@ -1025,7 +1025,7 @@ # ::A is an implied class c1 object mixin set B ? {c1 info precedence} "::B ::A ::C ::nx::Object" - ? {c1 info object mixin classes -heritage} "::B ::A" + ? {c1 info lookup mixins} "::B ::A" # ::A is as well implied by ::PCM C mixin set PCM @@ -1037,7 +1037,7 @@ # ::A is not ordered after ::B but after ::PCM ? {c1 info precedence} "::B ::PCM ::A ::C ::nx::Object" - ? {c1 info object mixin classes -heritage} "::B ::PCM ::A" + ? {c1 info lookup mixins} "::B ::PCM ::A" } #