Getting unevaluated tcl arguments

Posted by user1327792 on Stack Overflow See other posts from Stack Overflow or by user1327792
Published on 2012-04-11T23:24:35Z Indexed on 2012/04/11 23:29 UTC
Read the original article Hit count: 157

Filed under:

What I want to do is parse an argument to a tcl proc as a string without any evaluation. For example if I had a trivial proc that just prints out it's arguments:

proc test { args } { puts "the args are $args" }

What I'd like to do is call it with:

test [list [expr 1+1] [expr 2+2]]

And NOT have tcl evaluate the [list [expr 1+1] [expr 2+2]]. Or even if it evaluated it I'd still like to have the original command line. Thus with the trivial "test" proc above I'd like to be able to return:

the args are [list [expr 1+1] [expr 2+2]]

Is this possible in tcl 8.4 ?

Thank you.

-MP

© Stack Overflow or respective owner

Related posts about tcl