Tcl Source Code

View Ticket
Login
Ticket UUID: 1165062
Title: TIP #182: [expr bool()] implementation
Type: Patch Version: TIP Implementation
Submitter: mistachkin Created on: 2005-03-17 08:10:07
Subsystem: 45. Parsing and Eval Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-05-25 23:13:17
Resolution: Accepted Closed By: dgp
    Closed on: 2005-05-25 16:13:17
Description:
Please refer to TIP #182.
User Comments: dgp added on 2005-05-25 23:13:17:
Logged In: YES 
user_id=80530


Committed for 8.5a3.

dgp added on 2005-05-21 00:05:35:

File Deleted - 135061: 



File Added - 135303: 1165062.patch

Logged In: YES 
user_id=80530


updated patch to reflect
the fixing of Bug 1201589.

dgp added on 2005-05-19 04:11:36:

File Deleted - 134392: 



File Added - 135061: 1165062-final.patch

dgp added on 2005-05-19 04:11:35:
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.

dgp added on 2005-05-18 22:16:27:
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.

mistachkin added on 2005-05-18 12:21:32:

File Added - 134939: boolTypeFix.diff

mistachkin added on 2005-05-18 12:18:51:
Logged In: YES 
user_id=113501


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

dgp added on 2005-05-17 21:08:25:
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...

mistachkin added on 2005-05-17 13:20:59:
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);

dgp added on 2005-05-14 03:16:28:

File Added - 134392: 1165062.patch

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.

dgp added on 2005-05-12 22:45:15:

File Added - 134206: tip182.patch

Logged In: YES 
user_id=80530


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

mistachkin added on 2005-03-17 15:10:08:

File Added - 126038: TIP-182v1.diff

Attachments: