Posted to tcl by colin at Sat Mar 03 00:36:17 GMT 2007view raw
- package require extend
- package provide namespace 1.0
- # Extra useful namespace commands
- extend namespace {
- # return a flattened namespace hierarchy containing all
- # descendents of the given namespace
- proc tree {namespace} {
- set result {}
- foreach ns [namespace children $namespace] {
- lappend result $ns
- lappend result {*}[tree $namespace]
- }
- return $result
- }
- }