View Ticket
Not logged in
2025-05-02
07:48 Ticket [3a24cc9df1] Switch statement case fails when using a open parenthesis in a comment status still Closed with 5 other changes artifact: 6e7284f52c user: pooryorick
2025-04-28
14:19 Closed ticket [3a24cc9df1]. artifact: 3b8cbf15dc user: mookie
2025-04-12
23:57 Ticket [3a24cc9df1]: 3 changes artifact: ff6dcaf77d user: griffin
22:48 Ticket [3a24cc9df1]: 4 changes artifact: 3403614bce user: mookie
22:45 Ticket [3a24cc9df1]: 4 changes artifact: 127b1ab3c2 user: mookie
22:45 Ticket [3a24cc9df1]: 3 changes artifact: ca870d1eb8 user: mookie
22:44 Ticket [3a24cc9df1]: 3 changes artifact: c17a0cfb61 user: mookie
22:43 Ticket [3a24cc9df1]: 3 changes artifact: 2be0e11855 user: mookie
22:42 New ticket [3a24cc9df1]. artifact: abeebf93f1 user: mookie

Ticket UUID: 3a24cc9df1619a130120e8cef8560aef0561c1f0
Title: Switch statement case fails when using a open parenthesis in a comment
Type: Bug Version: 9.x
Submitter: mookie Created on: 2025-04-12 22:42:59
Subsystem: 69. Other Assigned To: nobody
Priority: 2 Severity: Minor
Status: Closed Last Modified: 2025-05-02 07:48:56
Resolution: Invalid Closed By: pooryorick
    Closed on: 2025-05-02 07:48:56
Description:
Example code:

proc yay {lang} {
    switch $lang { 
        tcl { 
	    puts "Yay! TCL"
            # having this { will break this case now
        }
    }
} ;# end proc

I then have to apply an additional { to the get the syntax to execute but results with invalid command name "}"

% yay "tcl"
Yay! TCL
invalid command name "}"

Not sure feature, or bug; so feel free to close. 

Surely a comment is a comment and shouldn't be executed? If recall correctly it's down to that switch cases are executed as lists. FWIW.
User Comments: mookie added on 2025-04-28 14:19:16:
Many Thanks.

griffin added on 2025-04-12 23:57:56:
This behavior is expected. Tcl is not parsed like other programming languages. It is an organized collection of strings that can be evaluated to do things. 
Read this man page carefully. https://www.tcl-lang.org/man/tcl8.6/TclCmd/Tcl.htm 
It defines everything you need to know about Tcl. 

This is an over simplification: There is no “comment” in Tcl. Instead, commands that start with a # are ignored. 

I hope this helps.