Skip to content
Tcl Source Code History Of Ticket 8f741de59dbc79b0
Login

History Of Ticket 8f741de59dbc79b0

Artifacts Associated With Ticket 8f741de59dbc79b0

  1. Ticket change [8bdba0dc55] (rid 247948) by juliannoble2 on 2025-11-10 08:47:37:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. 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.
      
    5. is_private initialized to: "0"
    6. login: "juliannoble2"
    7. priority initialized to: "5 Medium"
    8. private_contact initialized to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "juliannoble2"
    13. subsystem initialized to: "18. Commands M-Z"
    14. title initialized to:
      switch compilation difference with end of opts marker
      
    15. type initialized to: "Bug"
  2. Ticket change [9daedf38f9] (rid 249353) by jan.nijtmans on 2025-12-09 09:00:25:

    1. 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 ....)
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [de939e7188] (rid 252094) by apnadkarni on 2026-03-14 04:52:57:

    1. closedate changed to: "2461113.703447442"
    2. closer changed to: "apnadkarni"
    3. 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.
      
    4. login: "apnadkarni"
    5. mimetype: "text/x-markdown"
    6. resolution changed to: "Wont Fix"
    7. status changed to: "Closed"