Overview
| Artifact ID: | 432cd065c73299cc7cc7cc58d21afb0ed1830c54 |
|---|---|
| Ticket: | 3408408fffffffffffffffffffffffffffffffff
Erratic sharing/duplication of values in [expr] |
| User & Date: | ferrieux on 2011-09-13 06:22:11 |
Changes
- assignee changed to: "dgp"
- cmimetype changed to: "text/plain"
- comment changed to:
To save memory by sharing oft-used values, a natural technique would be lappend storage [expr {$computed_bit?1:0}] Unfortunately, the 1 and 0 values coming out of the [expr] are *not* extra references to the hugely shared literals, but fresh copies. A mysterious workaround guessed out of the blue by Colin is: lappend storage [expr {$computed_bit==1}] Funnily, the ternary operator *can* respect sharing with more complex values: set list1 [list yes yes yes] set list2 [list no no no] lappend storage [expr {$computed_bit?$LIST1:$LIST2}] All three behaviors are suprising... - foundin changed to: "None"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "ferrieux"
- subsystem changed to: "48. Number Handling"
- title changed to: "Erratic sharing/duplication of values in [expr]"
- type changed to: "Bug"