Artifacts Associated With Ticket 8f741de59dbc79b0
Ticket change [8bdba0dc55] (rid 247948) by juliannoble2 on 2025-11-10 08:47:37:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
The below comment block in tclCompCmdSz.c suggests the intention is for switch -exact word {pattern body ...} to be treated the same as switch -exact -- word {pattern body ...} as far as compilation is concerned. Similarly for -glob and -regexp However, the -- seems to be required for the compilation to proceed as after the option processing loop we have: if (numWords < 3) { return TCL_ERROR; } #comments from tclCompCmdsSZ.c TclCompileSwitchCmd # /* # * Only handle the following versions: # * switch ?--? word {pattern body ...} # * switch -exact ?--? word {pattern body ...} # * switch -glob ?--? word {pattern body ...} # * switch -regexp ?--? word {pattern body ...} # * switch -- word simpleWordPattern simpleWordBody ... # * switch -exact -- word simpleWordPattern simpleWordBody ... # * switch -glob -- word simpleWordPattern simpleWordBody ... # * switch -regexp -- word simpleWordPattern simpleWordBody ... # * When the mode is -glob, can also handle a -nocase flag. # * # * First off, we don't care how the command's word was generated; we're # * compiling it anyway! So skip it... # */ It is verifiable with tcl::unsupported::disassemble that (for the combined pattern body versions) switch -exact word {pattern body ...} compiles differently to switch -exact -- word {pattern body ...} (as with -glob and -exact) Is this intentional? It seems at odds with the comment block and also the switch man page states for the end of options marker: "This is not required when the matching patterns and bodies are grouped together in a single argument." Well it's not *required* as such - but it seems to me it is required if you want the best performance from a switch statement. - is_private initialized to: "0"
- login: "juliannoble2"
- priority initialized to: "5 Medium"
- private_contact initialized to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "juliannoble2"
- subsystem initialized to: "18. Commands M-Z"
- title initialized to:
switch compilation difference with end of opts marker
- type initialized to: "Bug"
Ticket change [9daedf38f9] (rid 249353) by jan.nijtmans on 2025-12-09 09:00:25:
- icomment:
> Is this intentional? I don't think this is intentional. Would you like to provide a patch? That would be the quickest way to resolve this (anyone else has to dive into this, which you already did ....)
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [de939e7188] (rid 252094) by apnadkarni on 2026-03-14 04:52:57:
- closedate changed to: "2461113.703447442"
- closer changed to: "apnadkarni"
- icomment:
Julian, I believe this is intentional based on [these](https://core.tcl-lang.org/tcl/file?ci=fc899be8f00fdd2c&name=generic%2FtclCompCmdsSZ.c&ln=1829-1833) comments. Please re-open if you disagree with the ease of implementation reference in the comment referenced.
- login: "apnadkarni"
- mimetype: "text/x-markdown"
- resolution changed to: "Wont Fix"
- status changed to: "Closed"