DC-WG: Tcl Comment Quirks

Robert A. Dilly (dilly@btv.ibm.com)
Tue, 16 Nov 1999 17:07:57 -0500

Folks-
Here's a quick Tcl sample which illustrates the
issue regarding the quirks in rules regarding
comments. As Mark observed, there's a similar
quirk when embedding comments in certain places
within a switch cited by Welch*. He writes,
"A comment can only occur where the Tcl parser
expects a command to begin." That's probably
applicable in these cases as well, but I'm
not making the connection just now.

Bottom line as we discussed is that this is a
Tcl thing, not a DCDL thing

Bob

* "Practical Programming in Tcl and Tk",
second edition, Brent B. Welsh, Prentice Hall.

========================================

#!/usr/prod/contrib/bin/tclsh
#<LISTING>
# -------------------------------------------
# These comments are fine
# -------------------------------------------
# if { 0 == 1 } {
if { 0 == 0 } {
puts hello
}

# foreach xx [info commands] {
foreach xx [info commands] {
puts $xx
}

# -------------------------------------------
# These produce an error like:
# missing close-brace
# -------------------------------------------
if { 0 == 0 } {
# if { 0 == 1 } {
puts hello
}

foreach xx [info commands] {
# foreach xx [info commands] {
puts $xx
}

#</LISTING>

--
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 IBM Microelectronics Division          ASIC Synthesis and Timing Team
 --------------------------------     --------------------------------
 Bob Dilly                            802-769-7786    dilly@us.ibm.com
 IBM  -  Dept G46V  -  MS 863K
 Essex Junction, VT 05452-4299        tie 446-7786   /  dilly@btv.vnet