Index: TODO =================================================================== diff -u -r679673bb15bf8d19c0c6cf5a928e07f9508e9b98 -rcd33e8cefca1d52063ebcb6689e46527bb94e33d --- TODO (.../TODO) (revision 679673bb15bf8d19c0c6cf5a928e07f9508e9b98) +++ TODO (.../TODO) (revision cd33e8cefca1d52063ebcb6689e46527bb94e33d) @@ -4901,7 +4901,14 @@ nsf.c: - fix small memory leak in multiple inheritance code. - all regression tests reun cleanly with --enable-memcount=yes +- let [current methodpath] return full path (similar to -path option + in "info methods" +- handle collateral damage in regression test due to changed result + of "current methodpath" +nx::traits: +- handle ensemble methods correctly (use full method path for resolution) +- add new regression tests for traits ======================================================================== TODO: @@ -5074,12 +5081,6 @@ - nicht gewartete/nicht getestete library aus distro entfernen? - migration von einzelnen paketen nach next? von welchen? -- Sind [current method] + [current methodpath] beide notwendig? warum - nicht nur ein introspektionscmd, das abhängig vom kontext eine liste - mit 1 element (non-ensemble method) oder mehreren (ensemble leaf - method) zurückliefert. Ein Test, ob man sich in einer ensemble methode - befindet oder nicht, bedarf dann nur eines [current] calls und nicht 2 - etc. Ein paar Punkte im folgenden könnten obsolet sein: Index: generic/nsf.c =================================================================== diff -u -r679673bb15bf8d19c0c6cf5a928e07f9508e9b98 -rcd33e8cefca1d52063ebcb6689e46527bb94e33d --- generic/nsf.c (.../nsf.c) (revision 679673bb15bf8d19c0c6cf5a928e07f9508e9b98) +++ generic/nsf.c (.../nsf.c) (revision cd33e8cefca1d52063ebcb6689e46527bb94e33d) @@ -21903,9 +21903,10 @@ break; case CurrentoptionMethodpathIdx: - Tcl_SetObjResult(interp, NsfMethodNamePath(interp, - NULL /* use topmost frame */, - NULL /* exclude leaf */)); + cscPtr = CallStackGetTopFrame0(interp); + Tcl_SetObjResult(interp, NsfMethodNamePath(interp, + NULL /* use topmost frame */, + Tcl_GetCommandName(interp, cscPtr->cmdPtr))); break; case CurrentoptionClassIdx: /* class subcommand */ Index: library/nx/nx.tcl =================================================================== diff -u -rc1b0280fcc98b5ac8c94b36e274e1ae0906364d5 -rcd33e8cefca1d52063ebcb6689e46527bb94e33d --- library/nx/nx.tcl (.../nx.tcl) (revision c1b0280fcc98b5ac8c94b36e274e1ae0906364d5) +++ library/nx/nx.tcl (.../nx.tcl) (revision cd33e8cefca1d52063ebcb6689e46527bb94e33d) @@ -479,7 +479,7 @@ if {[catch {set obj [uplevel ::nsf::current]}]} { error "ensemble dispatch called outside of method context" } - set path [::nsf::current methodpath] + set path [lrange [::nsf::current methodpath] 0 end-1] set l [string length $path] set submethods [$obj ::nsf::methods::object::info::lookupmethods -path "$path *"] foreach sm $submethods {set results([lindex [string range $sm $l+1 end] 0]) 1} Index: tests/disposition.test =================================================================== diff -u -r19a5c5816fedc7838506e9dab92fdda35058ac71 -rcd33e8cefca1d52063ebcb6689e46527bb94e33d --- tests/disposition.test (.../disposition.test) (revision 19a5c5816fedc7838506e9dab92fdda35058ac71) +++ tests/disposition.test (.../disposition.test) (revision cd33e8cefca1d52063ebcb6689e46527bb94e33d) @@ -911,7 +911,7 @@ ? { [C create c1] FOO foo; # N c1 eval {set :msg} - } "::c1--FOO--foo" + } "::c1--FOO foo--foo" # # Submethod levels greater than 1 turn into intermittent frames: @@ -923,7 +923,7 @@ ? { [C create c3] BAR BOO buu; # N c3 eval {set :msg} - } "::c3--BAR BOO--buu" + } "::c3--BAR BOO buu--buu" # // Parameter (alias) dispatch // @@ -940,7 +940,7 @@ C setObjectParams [list FOO:alias] ? { [C create c2 foo] eval {set :msg}; # N - } "::c2--FOO--foo" + } "::c2--FOO foo--foo" # # 1) Interleaving @Type(INACTIVE) frames through indirection @@ -966,7 +966,7 @@ ? { [C create c1] FOO foo; # N c1 eval {set :msg} - } "::c1--FOO--foo" + } "::c1--FOO foo--foo" # N+6 |:CscFrame @Type(ENSEMBLE)| <-- foo (leaf) # N+5 |:CscFrame @Call(ENSEMBLE)| <-- FOO (root) @@ -978,7 +978,7 @@ C setObjectParams [list FOO:alias] ? { [C create c2 foo] eval {set :msg}; # N - } "::c2--FOO--foo" + } "::c2--FOO foo--foo" # ... the filter variant ... C mixin {} @@ -995,7 +995,7 @@ ? { [C create c1] FOO foo; # N c1 eval {set :msg} - } "::c1--FOO--foo" + } "::c1--FOO foo--foo" # N+6 |:CscFrame @Type(ENSEMBLE)| <-- foo (leaf) # N+5 |:CscFrame @Call(ENSEMBLE)| <-- FOO (root) @@ -1007,7 +1007,7 @@ C setObjectParams [list FOO:alias] ? { [C create c2 foo] eval {set :msg}; # N - } "::c2--FOO--foo" + } "::c2--FOO foo--foo" C filter "" @@ -1028,27 +1028,27 @@ } C::slot::__FOO object mixin M2 - ? {C::slot::__FOO foo} "::M2--::C::slot::__FOO----foo" + ? {C::slot::__FOO foo} "::M2--::C::slot::__FOO--foo--foo" C::slot::__FOO eval {unset :msg} C setObjectParams [list] ? { [C create c1] FOO foo; # N c1 eval {set :msg} - } "::c1--FOO--foo" + } "::c1--FOO foo--foo" C::slot::__FOO object mixin {} C::slot::__FOO public object method intercept {} { return "[current]--[next]" } C::slot::__FOO object filter intercept - ? {C::slot::__FOO foo} "::C::slot::__FOO--::C::slot::__FOO----foo" + ? {C::slot::__FOO foo} "::C::slot::__FOO--::C::slot::__FOO--foo--foo" C setObjectParams [list] ? { [C create c1] FOO foo; # N c1 eval {set :msg} - } "::c1--FOO--foo" + } "::c1--FOO foo--foo" # -- @@ -1075,7 +1075,7 @@ [C create c1] FOO foo; # N #puts stderr "/ / / / / / / / / / / " c1 eval {set :msg} - } "(1)--::c1--FOO--foo--(3)--::M2--FOO--::c1" + } "(1)--::c1--FOO foo--foo--(3)--::M2--FOO foo--::c1" C mixin {} } @@ -1093,17 +1093,15 @@ } # ::nsf::method::alias C FOO ::foo - ? {[C create c] FOO} "::c--FOO" + ? {[C create c] FOO} "::c-FOO-FOO" C setObjectParams [list [list FOO:alias,noarg ""]] - ? {C create c} "::c--FOO" + ? {C create c} "::c-FOO-FOO" C public method "show me" {} { - set :msg [::nsf::current]-[::nsf::current methodpath]-[::nsf::current method] + set :msg [::nsf::current]-[::nsf::current methodpath] } C setObjectParams [list -show:alias] ? {[C create c -show me] eval {info exists :msg}} 1 - # UNPATCHED: - # ? {[C create c -show me] eval {set :msg}} "::c-{} show" - ? {[C create c -show me] eval {set :msg}} "::c-show-me" + ? {[C create c -show me] eval {set :msg}} "::c-show me" # # ... with mixin indirection @@ -1118,14 +1116,14 @@ next; } :public method FOO args { - error [::nsf::current]-[::nsf::current methodpath]-[::nsf::current method] + error [::nsf::current]-[::nsf::current methodpath] } } C setObjectParams [list [list FOO:alias,noarg ""]] C mixin add M - ? {C create c} "::c--FOO" + ? {C create c} "::c-FOO" C mixin {} @@ -1141,11 +1139,11 @@ ::nsf::method::alias C FOO ::callee C setObjectParams [list [list FOO:alias,noarg ""]] - ? {C create c} "::c" "Defaultmethod of calle is invoked ..." + ? {C create c} "::c" "Defaultmethod of callee is invoked ..." C setObjectParams [list [list FOO:alias "foo"]] - ? {C create c} "::callee-FOO" "foo leaf method is selected ..." + ? {C create c} "::callee-FOO foo" "foo leaf method is selected ..." ::callee object mixin add M - ? {C create c} "::callee-FOO" "With mixin ..." + ? {C create c} "::callee-FOO foo" "With mixin ..." # # ... at the calling object level / ensemble path @@ -1162,7 +1160,7 @@ } } - ? {C create c} "::callee-FOO" "With mixin ..." + ? {C create c} "::callee-FOO foo" "With mixin ..." # # ... with filter indirection: tbd Index: tests/submethods.test =================================================================== diff -u -rc1b0280fcc98b5ac8c94b36e274e1ae0906364d5 -rcd33e8cefca1d52063ebcb6689e46527bb94e33d --- tests/submethods.test (.../submethods.test) (revision c1b0280fcc98b5ac8c94b36e274e1ae0906364d5) +++ tests/submethods.test (.../submethods.test) (revision cd33e8cefca1d52063ebcb6689e46527bb94e33d) @@ -189,14 +189,14 @@ return something } :public method "info has something path" {} { - return [concat [::nsf::current methodpath] [::nsf::current method]] + return [::nsf::current methodpath] } :public method "info has something better" {} { nx::next return better } :public method foo {} { - return [concat [::nsf::current methodpath] [::nsf::current method]] + return [::nsf::current methodpath] } } nx::Object mixin add M @@ -412,7 +412,7 @@ # o eval { - :public object method faz {} {return [concat [current methodpath] [current method]]} + :public object method faz {} {return [current methodpath]} ? [list set _ [:faz]] "faz" } @@ -421,7 +421,7 @@ # o eval { - set body {? [list set _ [:bar]] [current class]-[current]-[concat [current methodpath] [current method]]} + set body {? [list set _ [:bar]] [current class]-[current]-[current methodpath]} :public object method "FOO foo" {} $body :public object method "BAR BUU boo" {} $body :public object method baz {} $body @@ -434,7 +434,7 @@ :baz :object method "a b" {} $calleeBody - set body {? [list set _ [:a b]] [current class]-[current]-[concat [current methodpath] [current method]]} + set body {? [list set _ [:a b]] [current class]-[current]-[current methodpath]} :public object method "FOO foo" {} $body :public object method "BAR BUU boo" {} $body :public object method baz {} $body @@ -445,7 +445,7 @@ # TODO: :method "a b c" {} $calleeBody; FAILS -> "can't append to scripted" :object method "x y z" {} $calleeBody; - set body {? [list set _ [:x y z]] [current class]-[current]-[concat [current methodpath] [current method]]} + set body {? [list set _ [:x y z]] [current class]-[current]-[current methodpath]} :public object method "FOO foo" {} $body :public object method "BAR BUU boo" {} $body :public object method baz {} $body @@ -461,7 +461,7 @@ # C eval { - set body {? [list set _ [:bar]] [current class]-[current]-[concat [current methodpath] [current method]]} + set body {? [list set _ [:bar]] [current class]-[current]-[current methodpath]} :public method "FOO foo" {} $body :public method "BAR BUU boo" {} $body :public method baz {} $body @@ -495,7 +495,7 @@ Class create Z { :object property -accessor public msg :method intercept args { - [current class] eval [list set :msg [list [current methodpath] \ + [current class] eval [list set :msg [list [lrange [current methodpath] 1 end-1] \ [current calledmethod] \ [current calledclass] \ [current nextmethod]]]