From: <no...@so...> - 2000-11-24 15:14:36
|
Bug #119153, was updated on 2000-Oct-25 22:02 Here is a current snapshot of the bug. Project: Tcl Category: Compiler and Objects Status: Open Resolution: None Bug Group: 8.1b1 Priority: 5 Summary: "!" operator can't handle string booleans Details: 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 - Follow-Ups: Date: 2000-Nov-24 07:14 By: dkf Comment: Added test to detect this. ------------------------------------------------------- For detailed info, follow this link: http://sourceforge.net/bugs/?func=detailbug&bug_id=119153&group_id=10894 |