Skip to content
Tcl Source Code History Of Ticket 3588512fff
Login

History Of Ticket 3588512fff

Artifacts Associated With Ticket 3588512fff

  1. Ticket change [3d7b9b3aef] (rid 121098) by heinrichmartin on 2012-11-19 15:13:07:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. 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
      
    4. foundin initialized to: "current: 8.6.0"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "heinrichmartin"
    10. subsystem initialized to: "None"
    11. title initialized to: "expr { ( ! true ) == false }"
    12. type initialized to: "Bug"
  2. Ticket change [d25f53e533] (rid 113525) by sebres on 2012-11-20 00:36:09:

    1. 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
      
      
    2. login: "sebres"
    3. mimetype: "text/plain"
    4. username: "sebres"
  3. Ticket change [5a8cce66d2] (rid 118159) by dkf on 2012-11-20 05:21:34:

    1. assignee changed to: "dgp"
    2. 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…
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. subsystem changed to: "47. Bytecode Compiler"
    6. username: "dkf"
  4. Ticket change [03ea9d5795] (rid 119907) by heinrichmartin on 2012-11-20 14:15:21:

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