Skip to content
Tcl Source Code View Ticket
Login

View Ticket

tcl finds close braces when they are in commented lines

Closed / Fixed217905ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:45:43
OriginalBugID: 2594 Bug
Version: 8.2
SubmitDate: '1999-08-20'
LastModified: '1999-08-20'
Severity: LOW
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 1367
OS: Windows 98
Machine: X86
FixedDate: '2000-10-25'
ClosedDate: '1999-08-20'


Name:

Devananda van der Veen



CVS:

8/18/99



ReproducibleScript:

button .b -text hello -command {

    puts "Hello"

    # this line should be ignored but its not }

    puts "and this will only print once"

    

    # but this line is ignored }

    

    pack .b



ObservedBehavior:

There is no close-brace to match the open-brace of the -command option.

    However, the script executes just fine, closing the -command section at

    the end of the second line, before the second puts command. Tcl must

    have read the "}" at the end of the commented line.... which it should

    not do! However, it does not give an error for wither of the other

    commented lines, which implies that Tcl only interprets close-braces in

    commented lines when there is a matching open brace.



DesiredBehavior:

Tcl should completely ignore lines that have been commented out.





This is the expected behavior.  Brace balancing has precedent over
comment detection, which can lead to programming errors like the
above.  Compare with this perfectly legal statement:
    if {1} { puts hello; # I just puts'ed it }

The parser will check that the if has two args first, then when
true it will eval the body arg and see the two commands, the
second being a comment.  
-- 08/20/1999 hobbs
welch Closed ticket [217905ffff]. [History diff]2000-10-26 08:09:12
dgp Ticket [217905ffff]: 3 changes [History diff]2001-04-14 02:08:44
Log in (anonymous is fine) to add a comment.