Browse Source

punk::ns use ordinary namespace eval instead of slower experimental nseval

master
Julian Noble 1 year ago
parent
commit
da6ff954a4
  1. 23
      src/modules/punk/ns-999999.0a1.0.tm

23
src/modules/punk/ns-999999.0a1.0.tm

@ -216,7 +216,8 @@ namespace eval punk::ns {
set parent [nsprefix $fqns]
set tail [nstail $fqns]
#puts ">>> parent $parent tail $tail"
set nslist [nseval $parent [list ::namespace children $tail]]
#set nslist [nseval $parent [list ::namespace children $tail]]
set nslist [namespace eval $parent [list ::namespace children $tail]]
return [lsort $nslist]
}
@ -433,7 +434,8 @@ namespace eval punk::ns {
#set parent [nsprefix $ns_absolute]
#set tail [nstail $ns_absolute]
set allchildren [lsort [nseval $base [list ::namespace children]]]
#set allchildren [lsort [nseval $base [list ::namespace children]]]
set allchildren [lsort [namespace eval $base [list ::namespace children]]]
#puts "->base:$base tailparts:$tailparts allchildren: $allchildren"
#puts "->base:$base tailparts:$tailparts childcount: [llength $allchildren]"
@ -912,13 +914,14 @@ namespace eval punk::ns {
set location $ch
#set exportpatterns [namespace eval $location {::namespace export}]
set exportpatterns [nseval $location {::namespace export}]
set exportpatterns [namespace eval $location {::namespace export}]
#set exportpatterns [nseval $location {::namespace export}]
set allexported [list]
set matched [list]
foreach p $exportpatterns {
if {[regexp {[*?]} $p]} {
lappend matched {*}[nseval $location [list ::info commands [nsjoin ${location} $p]]]
#lappend matched {*}[nseval $location [list ::info commands [nsjoin ${location} $p]]]
lappend matched {*}[namespace eval $location [list ::info commands [nsjoin ${location} $p]]]
foreach m $matched {
lappend allexported [nstail $m]
}
@ -928,7 +931,8 @@ namespace eval punk::ns {
}
set allexported [lsort -unique $allexported]
#NOTE: info procs within namespace eval is different to 'info commands' within namespace eval (info procs doesn't look outside of namespace)
set allprocs [nseval $location {::info procs}]
set allprocs [namespace eval $location {::info procs}]
#set allprocs [nseval $location {::info procs}]
set tails [lmap v $allchildren {nstail $v}]
set allaliases [list]
set allensembles [list]
@ -939,7 +943,8 @@ namespace eval punk::ns {
set interp_aliases [interp aliases ""]
#use aliases glob - because aliases can be present with or without leading ::
#NOTE: alias may not have matching command in the relevant namespce (renamed alias) so we can't just start with commands and check if it's an alias if we want to show all aliases
set raw_aliases [nseval $location [list ::aliases $glob]] ;#'aliases $glob' must be passed as list, not separate args to namespace eval.
set raw_aliases [namespace eval $location [list ::aliases $glob]] ;#'aliases $glob' must be passed as list, not separate args to namespace eval.
#set raw_aliases [nseval $location [list ::aliases $glob]] ;#'aliases $glob' must be passed as list, not separate args to namespace eval.
set aliases [list]
foreach a $raw_aliases {
if {[string match *:: $a]} {
@ -1117,8 +1122,10 @@ namespace eval punk::ns {
#pipecase \
# caseresult= $ns |input> { info commands ${input} }
#::pipecase \
# caseresult.= ::list $base $what |,basens/0,g/1> {::punk::ns::nseval $basens [::list ::info commands $g]}
::pipecase \
caseresult.= ::list $base $what |,basens/0,g/1> {::punk::ns::nseval $basens [::list ::info commands $g]}
caseresult.= ::list $base $what |,basens/0,g/1> {namespace eval $basens [::list ::info commands $g]}
}]
#lappend commandlist {*}[@@ok/result= $matchedcommands]

Loading…
Cancel
Save