|
2026-11-10
| ||
| 16:28 | • Closed ticket [3069454fff]: difference between bcc'ed and eval'ed regexp... artifact: 8a6a1569a9 user: oehhar | |
|
2026-10-18
| ||
| 21:15 | • Pending ticket [3069454fff]. artifact: 0d7b2d3ad2 user: jan.nijtmans | |
|
2026-10-15
| ||
| 22:01 | Fix [306945]: difference between bcc'ed and eval'ed regexp check-in: a478067f7a user: jan.nijtmans tags: core-9-0-branch | |
| 21:10 | Fix [3069454]: difference between bcc'ed and eval'ed regexp check-in: 43345b959d user: jan.nijtmans tags: trunk, main | |
|
2026-10-12
| ||
| 20:37 | • Ticket [3069454fff] difference between bcc'ed and eval'ed regexp sta... artifact: 49311822fd user: serhiy.storchaka | |
| 20:00 | • Ticket [3069454fff]: 7 changes artifact: 1371752253 user: jan.nijtmans | |
|
2026-10-10
| ||
| 20:15 | • Ticket [3069454fff]: 4 changes artifact: 3026e454c7 user: serhiy.storchaka | |
| 20:08 | Fix [3069454]: compiled [regexp] accepted abbreviations of -nocase but the command did not. Let the ... check-in: 564e42fd01 user: serhiy.storchaka tags: regexp-nocase-abbrev | |
|
2010-09-18
| ||
| 06:57 | • Ticket [3069454fff] difference between bcc'ed and eval'ed regexp sta... artifact: 80a50cde44 user: hobbs | |
|
2010-09-17
| ||
| 20:41 | • New ticket [3069454fff]. artifact: 88ed646070 user: msofer | |
difference between bcc'ed and eval'ed regexp
the [regexp] compiler does option completion, but the normal command does not?
% regexp -n FoO dogfood
bad switch "-n": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --
while evaluating {regexp -n FoO dogfood}
% proc a {} {regexp -n FoO dogfood}; a
1
The completion feature is tested in regexpComp.test: 21.6-7 and 24.6-7
Hmmm ... this seems to show that regexp itself is not consistent with standard Tcl option behavior, which is to allow uniq abbrs of options. Indeed, Tcl_RegexpObjCmd uses TCL_EXACT for getopts, whereas the compile cmd does a strcmp of len >= 2. It seems like it would be consistent to correct tclCompCmds.c to enforce the full -nocase, as regexp has behaved that way since 8.0, even if most Tcl commands allow abbr opts. Agreed?
Still the same in 8.6, 9.0 and 9.1: TclCompileRegexpCmd() accepts any prefix of -nocase of at least 2 characters, while Tcl_RegexpObjCmd() requires the full option name. string compare, string equal, string map, string match, switch, lsearch and lsort all accept abbreviations of -nocase.
Proposed fix in branch regexp-nocase-abbrev: instead of making the compiler exact, the command also accepts abbreviations of -nocase. This breaks nothing, since it only turns errors into successes. Other options still need their full names. Tests regexp-30.1 to 30.3.
Actually, I have a problem with some options within the same command being abbreviatable and others not. No other Tcl command does that.
So, my proposal variant is: [e93dfd305ea29e3b].
In this specific case, I don't see any negative side-effect doing that.
In general we should not advocate using abbreviated options, since it may cause incompatibilities if later options are added. But in manual typing in a shell, there's no harm, therefore many commands (especially when preceded with a minus-sign) allow that. We should - in my opinion - do the same here.
That is a decision for you. I only considered variants for
-nocase: either make it never abbreviated (simpler, but breaking,
and inconsistent with -nocase in other commands), or always
abbreviated. Making all options abbreviatable is a wider change.
Note that with all options abbreviatable some prefixes are ambiguous:
-a (-all, -about) and
-i/-in (-indices, -inline)
in regexp, and -l/-li/-lin
in both commands. -line can only be used in full, and
-a would mean -all in regsub but be an
error in regexp. -n is unique in both.
Two related mismatches between compiled code and the command, where the
compiler accepts an abbreviation that the command rejects as ambiguous:
[1ae976e237] (clock clicks -mi, new in 9.1) and [8ab06e31e3]
(self n).
Merged to [trunk] and core-9-0-branch.
Merge to 8.6 still to be done