Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a32e44f3ca661d2c029248bea673db24c68881ce
Ticket: 219153ffffffffffffffffffffffffffffffffff
"!" operator can't handle string booleans
User & Date: nobody on 2000-10-26 05:02:22
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1194 RFE
    Version: 8.1b1
    SubmitDate: '1999-02-11'
    LastModified: '1999-12-03'
    Severity: LOW
    Status: Assigned
    Submitter: pat
    ChangedBy: hobbs
    RelatedBugIDs: 616
    OS: Linux
    OSVersion: 2.0.35
    Machine: Other
    FixedDate: '2000-10-25'
    ClosedDate: '2000-10-25'
    
    
    Name:
    Steve McAndrewSmith
    
    ReproducibleScript:
    # These all work fine ...
    set b 1
    if { $b } { puts "ooga" }
    
    set b 0
    if { ! $b } { puts "ooga" }
    
    set b yes
    if { $b } { puts "ooga" }
    
    set b no
    if { $b } { puts "no ooga" } else { puts "ooga" }
    
    if { ($b && $b) || $b } { puts "ooga ooga ooga" }
    
    # This produces an error.:  can't use non-numeric string as operand of "!"
    if { ! $b } { puts "GAKK!" }
    
    ObservedBehavior:
    When using string boolean values (e.g. "true", "false", "yes", "no") in if expressions, the negation operator ("!") does not recognize the strings as boolean values.  Only "0" and "1" are correctly accepted.  It gives the following error:
    
      can't use non-numeric string as operand of "!" 
    
    However, both "&&" and "||" (and probably others) accept these boolean strings correctly.
    
    DesiredBehavior:
    "!true",  "!false", "!yes", and "!no" should all evaluate correctly.
    
    
    
    This is not the defined behavior.  03/23/1999 18:13 - surles -
    
  4. foundin changed to: "obsolete: 8.1b1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "10. Objects"
  10. title changed to: ""!" operator can't handle string booleans"
  11. type changed to: "Bug"