diff options
author | Steve Bennett <steveb@workware.net.au> | 2010-03-03 16:00:33 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2010-10-15 11:02:48 +1000 |
commit | b83beb2febcbe0abcf338e3f915b43889ce93eca (patch) | |
tree | 8baa5d1ff957f3209ac40a3d89d5fa5644796398 /tclcompat.tcl | |
parent | 80ddfb1fe799cde11aa65fcea5935686aacb4ca4 (diff) | |
download | jimtcl-b83beb2febcbe0abcf338e3f915b43889ce93eca.zip jimtcl-b83beb2febcbe0abcf338e3f915b43889ce93eca.tar.gz jimtcl-b83beb2febcbe0abcf338e3f915b43889ce93eca.tar.bz2 |
Move some core procs into the (Tcl) stdlib extension
Also implement 'local' to declare/delete local procs
* Add tests/alias.test for testing alias, current, local
* proc now returns the name of the proc created
* Add helper 'function' to stdlib
Reimplement glob and case to use local procs
* This keeps these internal procs out of the global namespace
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tclcompat.tcl')
-rw-r--r-- | tclcompat.tcl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tclcompat.tcl b/tclcompat.tcl index b631ae0..58dee97 100644 --- a/tclcompat.tcl +++ b/tclcompat.tcl @@ -34,20 +34,20 @@ proc case {var args} { } # Internal function to match a value agains a list of patterns - set checker [lambda {value pattern} {string match $pattern $value}] + local proc case.checker {value pattern} { + string match $pattern $value + } foreach {value action} $args { if {$value eq "default"} { set do_action $action continue - } elseif {[lsearch -bool -command $checker $value $var]} { + } elseif {[lsearch -bool -command case.checker $value $var]} { set do_action $action break } } - rename $checker "" - if {[info exists do_action]} { set rc [catch [list uplevel 1 $do_action] result opts] if {$rc} { @@ -214,5 +214,4 @@ proc throw {code {msg ""}} { return -code $code $msg } - set ::tcl_platform(platform) unix |