possible unbalanced brace in comment

我敢打赌,很多用expect写脚本的同学都遇到过这个问题。

一个小例子:

[shell]
if {$val == 1} {
# comments with {
send_user "Value is 1\n"
}
[/shell]

很明显,我们想要的效果是,向用户输出 “values is 1”这句话。可是他会报错:

“missing close-brace: possible unbalanced brace in comment”

究其原因,是因为注释最后不能加大括号。。。。。。

这本是tcl和expect脚本的一个bug,但貌似他们为了兼容以前的代码而拒绝修复这个bug,反而说这是语言特色。

whatever,不过在我看来,实在滑稽。

1 thought on “possible unbalanced brace in comment

Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.