我正在運行已嵌入到另一個系統中的tcl 8.5的化身。 該系統將接受並正確地執行命令,例如:tcl中的變量替換
uniformDist minAndMax {1 10}
其中uniformDist是一些對象,而我沒有內部的知名度。
我希望能這樣說:
set M 1000
uniformDist minAndMax {1 M}
但這不起作用。 也不 集合M 1000 uniformDist minAndMax {1 $ M}
我想:
u minAndMax {1 [eval $M]}
和
u minAndMax {1 [eval M]}
無論這些作品。
的錯誤信息是:
expected a real value: unable to convert from: "$M"Error: expected fewer arguments [Error while parsing pair]
或
expected a real value: unable to convert from: "[eval"Error: expected fewer arguments [Error while parsing pair]
什麼是TCL做的正確方法?
這就是它!謝謝! – elbillaf
還有使用''1 $ M''和'[subst {1 $ M}]',但'list'命令對複雜的替代品有最少的驚喜。 –
'「1 $ M」'在文本中已經:) –