Sujet : where is the TCL "macro" command ? De : aotto1968 (at) *nospam* t-online.de (aotto1968) Groupes :comp.lang.tcl Date : 28. Jun 2024, 07:37:37 Autres entêtes Organisation : A noiseless patient Spider Message-ID :<v5llnh$37llc$1@dont-email.me> User-Agent : Mozilla Thunderbird
Hi, the following code is ugly: proc block {args} { set code [lindex $args end] set args [lrange $args 0 end-1] foreach {var val} $args { uplevel [list push $var $val] } uplevel $code foreach {var val} $args { uplevel [list pop $var] } } I want to have macro block {args} { local code var val set code [lindex $args end] set args [lrange $args 0 end-1] foreach {var val} $args { push $var $val } eval $code foreach {var val} $args { pop $var } } the "macro" command evaluate the code IN the Frame of the calling "proc" arguments and "local" declared variables are local, all other variables are always in the frame of the calling "proc" mfg