Skip to content
Tcl Source Code History Of Ticket 1902890fffffffff
Login

History Of Ticket 1902890fffffffff

Artifacts Associated With Ticket 1902890fffffffff

  1. Ticket change [8b33c8584d] (rid 127522) by avl42 on 2008-02-27 10:20:54:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      From comp.lang.tcl: <[email protected]>
      
      % set pattern --; set text ----
      % regexp $pattern $text; # no error
      1
      % regexp -- ----   ; # error for same arguments.
      wrong # args: should be "regexp ?switches? [...]"
      
      This bug-report only documents the difference,
      not which of the two is to be considered correct.
      
      
    4. foundin initialized to: "obsolete: 8.5.1"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "avl42"
    10. subsystem initialized to: "47. Bytecode Compiler"
    11. title initialized to: "compiled regexp behaves differently"
    12. type initialized to: "Bug"
  2. Ticket change [8bb2cb4a6a] (rid 127612) by dgp on 2008-03-12 03:00:46:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      This is the same issue as the compiled
      two argument [switch].
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. priority changed to: "8"
    5. username: "dgp"
  3. Ticket change [c97c4e3120] (rid 122290) by dgp on 2008-03-12 03:02:40:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      That is, 1899962.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [c901f7282b] (rid 122210) by hobbs on 2008-03-12 12:05:23:

    1. icomment:
      Logged In: YES 
      user_id=72656
      Originator: NO
      
      I believe the 2nd variant (eval version) is what should be fixed.  The extended info from wrong#args is:
      
      wrong # args: should be "regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?"
      
      This indicates 2 known required args, and 2 args are given to regexp.  Why try to find errors when we can otherwise assume a regexp+2args == [regexp $pat $str] at all times?
      
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  5. Ticket change [f39e31084a] (rid 129743) by dgp on 2008-03-12 12:35:35:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      I agree that is the most sensible
      way to define the behavior of this
      command.
      
      The snag is that the implementation
      over many years *and the documentation*
      disagree, saying that anything that
      starts with "-" gets an attempt at
      interpretation as a switch.
      
      This is stupid, and it foils many
      cases that could otherwise be compiled,
      so I agree we should change it like
      we changed [switch].
      
      Just be ready for the same flood of
      complaints we got about the [switch]
      change.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [a1d9eeec7d] (rid 109797) by dkf on 2008-03-28 04:09:26:

    1. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      Be aware of the test regexp-20.2
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  7. Ticket change [835de74c71] (rid 117368) by dgp on 2008-03-28 04:14:19:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      dkf points out the roadblock case:
      
      % regexp -about foo
      0 {}
      % set e -about
      -about
      % set s foo
      foo
      % regexp $e $s
      0
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [e6f7a95525] (rid 104377) by msofer on 2008-07-21 11:40:14:

    1. assignee changed to: "hobbs"
    2. icomment:
      Logged In: YES 
      user_id=148712
      Originator: NO
      
      This is tclguy's turf, I believe (and hope)
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. username: "msofer"
  9. Ticket change [cd6ab5aa54] (rid 257561) by serhiy.storchaka on 2026-10-11 07:39:52:

    1. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
    2. icomment:
      Still the same in 8.6, 9.0 and 9.1. <tt>TclCompileRegexpCmd()</tt> can only check a literal RE for a leading "-"; an RE from a variable went straight to <tt>INST_REGEXP</tt>, which does not parse switches.
      
      I disagree with changing <tt>regexp</tt> to match the compiled behaviour: compilation is only an optimization, and the compiled code should always behave like the interpreted command. Proposed fix in branch [/timeline?r=regexp-compile-runtime-switch|regexp-compile-runtime-switch]: when the RE is not known at compile time and there is no <tt>--</tt>, the compiled code checks at runtime whether it starts with "-", and if so calls <tt>regexp</tt> itself. So compiled and interpreted <tt>regexp</tt> now behave the same, including <tt>-about</tt>, and ordinary REs still use <tt>INST_REGEXP</tt>. Tests regexpComp-25.1 to 25.7.
      
    3. login: "serhiy.storchaka"
    4. mimetype: "text/x-fossil-wiki"
  10. Ticket change [6c4f1a1898] (rid 257564) by serhiy.storchaka on 2026-10-11 07:45:23:

    1. icomment:
      With <tt>--</tt> the RE cannot be a switch, so the compiled code needs no runtime check: <tt>regexp -- $re $string</tt> is the safest and fastest way to match a variable RE. Much code in Tcl's library is already written this way.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  11. Ticket change [d836c78fdf] (rid 261888) by jan.nijtmans on 2026-11-18 17:44:43:

    1. assignee changed to: "jan.nijtmans"
    2. closer changed to: "nobody"
    3. comment changed to:
      From comp.lang.tcl: <[email protected]>
      
      % set pattern --; set text ----
      % regexp $pattern $text; # no error
      1
      % regexp -- ----   ; # error for same arguments.
      wrong # args: should be "regexp ?switches? [...]"
      
      This bug-report only documents the difference,
      not which of the two is to be considered correct.
      
    4. icomment:
      Merged to [6e93204003|trunk] and core-9-0-branch.
      
      Many thanks!
      
      Would be nice to backport for 8.6.19
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. severity changed to: "Minor"
    9. status changed to: "Pending"
  12. Ticket change [b40148c895] (rid 261914) by serhiy.storchaka on 2026-11-18 18:27:58:

    1. icomment:
      Backported to core-8-6-branch, together with [697b1bbfe3]: [b0610ccd6f].
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  13. Ticket change [36a88eaf3e] (rid 261918) by serhiy.storchaka on 2026-11-18 18:32:48:

    1. closedate changed to: "2461363.272776770872"
    2. closer changed to: "serhiy.storchaka"
    3. login: "serhiy.storchaka"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"