Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#406 TIP #182: [expr bool()] implementation

TIP Implementation
closed-accepted
Don Porter
5
2005-05-25
2005-03-17
Joe Mistachkin
No

Please refer to TIP #182.

Discussion

1 2 > >> (Page 1 of 2)
  • Don Porter
    Don Porter
    2005-05-12

    Logged In: YES
    user_id=80530

    Here's an implementation
    updated to deal with the
    revisions of TIP 232.

     
    • labels: 310751 --> 45. Parsing and Eval
     
    • assigned_to: dkf --> dgp
     
  • Don Porter
    Don Porter
    2005-05-13

    Logged In: YES
    user_id=80530

    Here's a new patch that merges
    in the docs/tests from the first
    patch.

    Note the new bug 1201589
    discovered writing these tests.

     
  • Joe Mistachkin
    Joe Mistachkin
    2005-05-17

    Logged In: YES
    user_id=113501

    The new patch looks good. However, I still think we need to
    add the changes to tclExecute.c back into it.

    @@ -4506,7 +4509,14 @@
    * from the string rep.
    */
    if ((tPtr == &tclBooleanType) && (valuePtr->bytes ==
    NULL)) {
    - valuePtr->typePtr = &tclIntType;
    + /*
    + * JJM: For TIP #182, changed this from tclIntType to
    tclBooleanType
    + * so that [expr bool()] returns a "real" boolean. This
    change causes
    + * no test failures and should be totally innocuous
    because at this point
    + * we are guaranteed to have a numeric boolean result
    with no string rep
    + * per the enclosing if statement.
    + */
    + valuePtr->typePtr = &tclBooleanType;
    converted = 1;
    } else {
    s = Tcl_GetStringFromObj(valuePtr, &length);

     
  • Don Porter
    Don Porter
    2005-05-17

    Logged In: YES
    user_id=80530

    Thanks for the additional review.

    We can put that additional stanza of
    code into the patch if you really want
    it, but I don't think we should bother
    since it's a "dead" branch of code.

    Note that the patched area only runs
    for a "pure boolean" Tcl_Obj, something
    with no string rep, and a "boolean"
    Tcl_ObjType. In the development on
    the HEAD, that's no longer a valid
    state for a "boolean"; that is, there are
    no longer any pure booleans, since
    the "boolean" Tcl_ObjType is now used
    exclusively to cache the boolean
    equivalant of strings like "yes".

    Hmmm.... now I notice that task
    isn't yet complete. That's probably
    contributing to confusion. Let me take
    care of that...

     
  • Joe Mistachkin
    Joe Mistachkin
    2005-05-18

    Logged In: YES
    user_id=113501

    Here is an updated "boolean type fix" patch that logically
    goes with this TIP.

     
  • Don Porter
    Don Porter
    2005-05-18

    Logged In: YES
    user_id=80530

    Thanks. That updated patch modifies
    only stanzas dealing with "pure booleans".
    If that code still survives when we
    integrate a TIP 182 implementation, we'll
    include those changes in it.

     
  • Don Porter
    Don Porter
    2005-05-18

    Logged In: YES
    user_id=80530

    Those stanzas are now out of the HEAD.

    Attaching another patch updated to
    the HEAD; I think TIP 182 is ready
    for voting.

     
  • Don Porter
    Don Porter
    2005-05-20

    Logged In: YES
    user_id=80530

    updated patch to reflect
    the fixing of Bug 1201589.

     
1 2 > >> (Page 1 of 2)