Posted to tcl by pooryorick at Sun Nov 08 05:01:54 GMT 2015view pretty
#grap scriptSplit from http://wiki.tcl.tk/21701
rename proc ::tcl::proc
::tcl::proc proc {name args body} {
::uplevel [::list ::tcl::proc $name $args [::list apply [::list args [
::string map [::list {${body}} [::list $body]] {
::foreach command [::scriptSplit ${body}] {
::if {[::catch [::list ::uplevel 1 $command] cres copts]} {
::tailcall ::errorhandler $cres $copts
}
}
}
]] [uplevel namespace current]]]
}