Artifacts Associated With Ticket 3588512
Ticket change [3d7b9b3aef] (rid 121098) by heinrichmartin on 2012-11-19 15:13:07:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OS: Debian Squeeze Promblem: expr is not consistent with boolean values and operators, i.e. [expr { ( ! true ) == false }] yields 0 Expected: "not true" is logically the same as "false" - expr should know that. A few notes: * tested in tclsh 8.5 * found no bugs for "expr" in current and developement * a fix could break existing code (that's why I put it in group developement) * workaround: always use bool() or !! for explicit conversion, i.e. [expr { ( ! true ) == bool ( false ) }] yields 1 - foundin initialized to: "current: 8.6.0"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "heinrichmartin"
- subsystem initialized to: "None"
- title initialized to: "expr { ( ! true ) == false }"
- type initialized to: "Bug"
Ticket change [d25f53e533] (rid 113525) by sebres on 2012-11-20 00:36:09:
- icomment:
This happens because "false" is not the same as boolean "0" (cause of saving it string representation): % expr { false } false % expr { (! true) } 0 So this code is true % expr { (! true) == 0 } 1 But in something you're right - it is not really consistent, cause: % expr { false == false } 1 - login: "sebres"
- mimetype: "text/plain"
- username: "sebres"
- icomment:
Ticket change [5a8cce66d2] (rid 118159) by dkf on 2012-11-20 05:21:34:
- assignee changed to: "dgp"
- icomment:
Part of the problem is that == isn't really the type of equality you're after; it does _numeric_ equalty and (when that's not type-compatible) otherwise string equality. Alas, '0==false' doesn't fit in that scheme too nicely. This might need to be a FRQ…
- login: "dkf"
- mimetype: "text/plain"
- subsystem changed to: "47. Bytecode Compiler"
- username: "dkf"
Ticket change [03ea9d5795] (rid 119907) by heinrichmartin on 2012-11-20 14:15:21:
- icomment:
well, then the documentation is wrong - or at least misleading. expr (==,!=): "Boolean equal and not equal. Each operator produces a zero/one result. Valid for all operand types." btw. why are "expr" and "if" in different bug categories?? another suggestion: is it useful to distinguish '0==false' (1) and '0=="false"' (0)? the parser knows about the boolean meaning of false - otherwise it would raise an invalid bareword exception! So, why is tcl using the string representation of false?
- login: "heinrichmartin"
- mimetype: "text/plain"
- username: "heinrichmartin"
- icomment: