引数の展開に tcl を使用{*}
していて、この問題に遭遇しました。
#!/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 :("
}
ご覧のとおり、リセット変数が定義されており、 と で評価しeval
てい{*}
ます。
eval
正常に動作している間、次の{*}
ようにエラーをスローしています
wrong # args: should be "set varName ?newValue?"
while executing
"{*}$reset"
次に、変数reset
を次のように変更しました。
set reset {
set count 0;
}
set
つまり、2 番目のステートメントを削除すると、コードは正常に動作します。
{*}
1 つのステートメントで正常に動作し、それ以上のステートメントでは動作しないのはなぜですか? または私はここで何が欠けていますか?