Index: TODO =================================================================== diff -u -r8eb8f0692e858ee3b4a7f90d0e16bae6f835330f -rf7e340c5779999c9495abbb4a2112057b34e1a97 --- TODO (.../TODO) (revision 8eb8f0692e858ee3b4a7f90d0e16bae6f835330f) +++ TODO (.../TODO) (revision f7e340c5779999c9495abbb4a2112057b34e1a97) @@ -2720,6 +2720,8 @@ * added "pattern" to "info slots" * extended regression test +- nx.tcl, xotcl2.tcl: removed unsafe {*}$pattern + TODO: - missing in c-based "info slots": * handle object specific "info slots" @@ -2733,9 +2735,6 @@ ... } -- The following is unsafe, but used in nx.tcl (and maybe as well by xotcl2.tcl) - obj method foo {{x ""}} { bar ... {*}$x } - - MixinComputeOrderFullList() could receive a flag to store source classes in checkList - if the check on eg. info-heritage-circular in test/info.method.tcl Index: library/nx/nx.tcl =================================================================== diff -u -r8eb8f0692e858ee3b4a7f90d0e16bae6f835330f -rf7e340c5779999c9495abbb4a2112057b34e1a97 --- library/nx/nx.tcl (.../nx.tcl) (revision 8eb8f0692e858ee3b4a7f90d0e16bae6f835330f) +++ library/nx/nx.tcl (.../nx.tcl) (revision f7e340c5779999c9495abbb4a2112057b34e1a97) @@ -493,10 +493,12 @@ if {[::nsf::object::exists $slot]} {return $slot} return "" } - :method "info slots" {{-type ::nx::Slot} {pattern ""}} { + :method "info slots" {{-type ::nx::Slot} pattern:optional} { set slotContainer [::nsf::self]::slot if {[::nsf::object::exists $slotContainer]} { - ::nsf::dispatch $slotContainer ::nsf::methods::object::info::children -type $type {*}$pattern + set cmd [list ::nsf::methods::object::info::children -type $type] + if {[::info exists pattern]} {lappend cmd $pattern} + return [::nsf::my {*}$cmd] } } :alias "info vars" ::nsf::methods::object::info::vars @@ -546,7 +548,7 @@ if {[info exists source]} {lappend cmd -source $source} if {$closure} {lappend cmd -closure} if {[info exists pattern]} {lappend cmd $pattern} - ::nsf::my {*}$cmd + return [::nsf::my {*}$cmd] } :alias "info subclass" ::nsf::methods::class::info::subclass :alias "info superclass" ::nsf::methods::class::info::superclass Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r9a1e1f585cad423f82dd15dbe974f8b1e5998f71 -rf7e340c5779999c9495abbb4a2112057b34e1a97 --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 9a1e1f585cad423f82dd15dbe974f8b1e5998f71) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision f7e340c5779999c9495abbb4a2112057b34e1a97) @@ -552,8 +552,10 @@ :proc check {} {::xotcl::checkoption_internal_to_xotcl1 [::nsf::method::assertion [self] check]} :alias class ::nsf::methods::object::info::class :alias children ::nsf::methods::object::info::children - :proc commands {{pattern ""}} { - my ::nsf::methods::object::info::methods -methodtype all {*}$pattern + :proc commands {pattern:optional} { + set cmd [list ::nsf::methods::object::info::methods -methodtype all] + if {[info exists pattern]} {lappend cmd $pattern} + return [my {*}$cmd] } :proc default {method arg varName} { # pass varName to be able produce the right error message @@ -619,8 +621,10 @@ :alias parent ::nsf::methods::object::info::parent :proc post {methodName} {my ::nsf::methods::object::info::method post $methodName} :proc pre {methodName} {my ::nsf::methods::object::info::method pre $methodName} - :proc procs {{pattern ""}} { - my ::nsf::methods::object::info::methods -methodtype scripted {*}$pattern + :proc procs {pattern:optional} { + set cmd [list ::nsf::methods::object::info::methods -methodtype scripted] + if {[info exists pattern]} {lappend cmd $pattern} + return [my {*}$cmd] } :alias slots ::nx::Object::slot::__info::slots :alias precedence ::nsf::methods::object::info::precedence @@ -647,7 +651,11 @@ :proc instargs {method} {::xotcl::info_args class [self] $method} :proc instbody {methodName} {my ::nsf::methods::class::info::method body $methodName} - :proc instcommands {{pattern ""}} {my ::nsf::methods::class::info::methods {*}$pattern} + :proc instcommands {pattern:optional} { + set cmd [list ::nsf::methods::class::info::methods] + if {[info exists pattern]} {lappend cmd $pattern} + return [my {*}$cmd] + } :proc instdefault {method arg varName} { set r [::xotcl::info_default class [self] $method $arg $varName] return $r @@ -664,7 +672,7 @@ return [my ::nsf::methods::class::info::forward {*}[self args]] } } - :proc instinvar {} {::nsf::method::assertion [self] class-invar} + :proc instinvar {} {::nsf::method::assertion [self] class-invar} :proc instmixin {-order:switch -guards:switch pattern:optional} { set cmd ::nsf::methods::class::info::mixinclasses if {$order} {lappend cmd "-heritage"} @@ -673,25 +681,31 @@ my {*}$cmd } :alias instmixinguard ::nsf::methods::class::info::mixinguard - :proc instmixinof {-closure {pattern ""}} { - my ::nsf::methods::class::info::mixinof -scope class \ - {*}[expr {$closure ? "-closure" : ""}] \ - {*}$pattern + :proc instmixinof {-closure:switch pattern:optional} { + set cmd [list ::nsf::methods::class::info::mixinof -scope class] + if {$closure} {lappend cmd -closure} + if {[info exists pattern]} {lappend cmd $pattern} + return [my {*}$cmd] } - :proc instparametercmd {{pattern ""}} { - my ::nsf::methods::class::info::methods -methodtype setter {*}$pattern + :proc instparametercmd {pattern:optional} { + set cmd [list ::nsf::methods::class::info::methods -methodtype setter] + if {[info exists pattern]} {lappend cmd $pattern} + return [my {*}$cmd] } :proc instnonposargs {method} {::xotcl::info_nonposargs class [self] $method} :proc instpost {methodName} {my ::nsf::methods::class::info::method postcondition $methodName} :proc instpre {methodName} {my ::nsf::methods::class::info::method precondition $methodName} - :proc instprocs {{pattern ""}} { - my ::nsf::methods::class::info::methods -methodtype scripted {*}$pattern + :proc instprocs {pattern:optional} { + set cmd [list ::nsf::methods::class::info::methods -methodtype scripted] + if {[info exists pattern]} {lappend cmd $pattern} + return [my {*}$cmd] } - :proc mixinof {-closure:switch {pattern ""}} { - my ::nsf::methods::class::info::mixinof -scope object \ - {*}[expr {$closure ? "-closure" : ""}] \ - {*}$pattern + :proc mixinof {-closure:switch pattern:optional} { + set cmd [list ::nsf::methods::class::info::mixinof -scope object] + if {$closure} {lappend cmd -closure} + if {[info exists pattern]} {lappend cmd $pattern} + return [my {*}$cmd] } :alias parameter ::nx::Class::slot::__info::attributes :alias subclass ::nsf::methods::class::info::subclass