I am using {*}
in tcl for argument expansion and come across this issue.
#!/usr/bin/tclsh
set reset {
set count 0;
set age 24;
}
puts $reset
eval $reset; # This is working fine. Commented out the below line and tried
{*}$reset; # This is throwing error. Commented out the above line and tried.
if { [ info exists count ] && [ info exists age ] } {
puts "count & age initialzed to $count and $age"
} else {
puts "count & age not initialzed :("
}
As you see, I have the reset variable defined and I am evaluating with eval
as well as with {*}
.
While eval
is working fine, {*}
is throwing error as
wrong # args: should be "set varName ?newValue?"
while executing
"{*}$reset"
Then I have changed the variable reset
as follows,
set reset {
set count 0;
}
i.e. I have removed the 2nd set
statement and the code works fine.
Why {*}
is working fine with one statement and not with more than that ? Or What I am missing here ?