[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Tcl comments and if statements



> Yup, if you comment out any one line that has a curly brace
> (like the if statement), then you must comment out the line
> w/ the matching brace.

That's what you'd expect, but try the following:

-------------------
proc parse { } {
# if {1} {
  if {1} {
  label .b -text okay
  pack .b
  } else {
  label .b -text {not okay}
  pack .b
  }
}

parse
----------------

The code should produce a parse error, when normally you wouldn't expect
that it would.  If you remove the open-brace in the comment, or adjust the
code so that it's no longer a procedure, then the error message disappears.

Brent Welsh's book has a warning about this tcl "feature" (page 17 in the
3rd edition).

Just my $0.02,

MD