Artifacts Associated With Ticket 1106138
Ticket change [ef5919aa13] (rid 108974) by ruffrecords on 2005-01-20 17:26:11:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I propose the addition of an option to the switch command to allow integer comparisons much like the switch statement in C.
- foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "ruffrecords"
- subsystem initialized to: "18. Commands M-Z"
- title initialized to: "Integer option to switch command"
- type initialized to: "RFE"
Ticket change [5821747fd5] (rid 117748) by dkf on 2005-01-21 15:56:19:
- icomment:
Logged In: YES user_id=79902 Matter was discussed on c.l.t: http://groups-beta.google.com/group/comp.lang.tcl/browse_frm/thread/a0b1398ff0b42638/66809fe88969cd04?_done=%2Fgroup%2Fcomp.lang.tcl%3Fhl%3Den%26&_doneTitle=Back+to+topics&_doneTitle=Back&&d#66809fe88969cd04 Idea is that this should work as (arithmetically) expected: switch -integer [expr {int(sqrt(4))}] { 0x00 { puts "root 4 is zero" } 0x01 { puts "root 4 is one" } 0x02 { puts "root 4 is two" } } i.e. We want an option for [switch] to use ==-like equality as well as eq-like equality. For the bytecode-compiled version, this is almost trivial (add check-integer and use INST_EQ instead of INST_STR_EQ) but it is a bit more work for the non-BC version. - login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [dfe3f2b683] (rid 261509) by serhiy.storchaka on 2026-11-13 11:18:43:
- closedate changed to: "2461357.9713335303"
- closer changed to: "serhiy.storchaka"
- icomment:
Implemented in Tcl 9.1 by TIP 730: switch -integer compares the value and the patterns as integers, so the example above matches 0x02.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"