Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5821747fd52dce5207ddb5826b517d637d7a54b5
Ticket: 1106138fffffffffffffffffffffffffffffffff
Integer option to switch command
User & Date: dkf on 2005-01-21 15:56:19
Changes

  1. 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.
    
    
  2. login: "dkf"
  3. mimetype: "text/plain"
  4. username: "dkf"