arguments - Passing list to Tcl procedure -
What is the legal way to pass a list in a Tcl process?
I would really like it if I can get it so that a list is automatically expanded into the variable number of an array.
Something similar is:
set myprocedure option1 option2 $ A
and
myprocedure option1 option2 bc
are the same.
I believe that I saw before, but I can not find it online anywhere, any help (and code) will be appreciated for making the two cases equivalent.
Is this considered a standard Tcl conference or am I barking the wrong tree?
It depends on the version of TCL you are using, however: 8.5:
set mylist {abc} myprocedure option1 option2 {*} $ mylist
For 8.4 and below:
setmylist {Abc} eval myprocedure option1 option2 $ mylist # Or, if option 1 and 2 variable eval myprocedure [list $ option1] [list $ option2] $ mylist # or, as Brian eval likes myprocedure \ $ option1 \ $ Option2 $ Mylist
Comments
Post a Comment