Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2be0e11855c7fd8763cfa9a8f7c3d85c365a3c3f965dbc9dd88deae822896784
Ticket: 3a24cc9df1619a130120e8cef8560aef0561c1f0
Switch statement case fails when using a open parenthesis in a comment
User & Date: mookie on 2025-04-12 22:43:40
Changes

  1. comment changed to:
    Example code:
    
    proc yay {lang} {
        switch $lang { 
            tcl { 
    	    puts "Yay! TCL"
                # having a a { will break this case now
            }
        }
    } ;# end proc
    
    yay "tcl"
    
    % proc yay_lang {lang} {
    	switch $lang { 
    		tcl { 
    			puts "Yay! TCL"
    			# having a a { will break this case now
    		}
    	}
    } ;# end proc
    
    }
    % yay_lang "tcl"
    Yay! TCL
    invalid command name "}"
    
    
    Not sure feature, or bug, so feel free to close, but surely a comment is a comment and shouldn't be executed?
    
    I recall correctly it's down to that switch cases are executed as lists. But something feels eery that you can't use a { in a comment.
    
  2. login: "mookie"
  3. mimetype: "text/plain"