From: Andreas K. <and...@gm...> - 2024-09-24 16:54:03
|
Hi all. I believe that I have found a bug in the `expr` command of Tcl 9 (commit <1f19a433ec>). This issue is, IMHO, __not__ a release blocker. It should not affect the Tcl level at all. Note however that it can trip/break scripts using extensions performing type-checks while not doing or able to do shimmering. IOW extensions expecting expect specific int-reps. Among the affected will be extensions providing objtypes do not have a string-rep, making shimmering impossible. Other extensions will simply shimmer the value back to the int-rep they need. This is why the script level is not affected, except for a performance loss I did not bother to try and measure. Test code: ``` proc show-type {x} { puts <>=[::tcl::unsupported::representation $x] } set i xx show-type $i show-type [expr {0 ? $i : $i}] show-type [expr {$i}] ``` For Tcl 8.6 the results are: ``` <>=value is a pure string with a refcount of 4, object pointer at 0x1ec87b0, string representation "xx" <>=value is a pure string with a refcount of 3, object pointer at 0x1ec9440, string representation "xx" <>=value is a pure string with a refcount of 3, object pointer at 0x1ecacd0, string representation "xx" ``` For Tcl 9 <commit 1f19a433ec> the results for the `expr` command change: ``` <>=value is a pure string with a refcount of 4, object pointer at 0x55dc2b5776d0, string representation "xx" <>=value is a list with a refcount of 3, object pointer at 0x55dc2b52aab0, internal representation 0x55dc2b5a30a0:0x0, string representation "xx" <>=value is a list with a refcount of 3, object pointer at 0x55dc2b578c00, internal representation 0x55dc2b5a30a0:0x0, string representation "xx" ``` It looks as if the $x going into `expr` is wrapped into a single-element list. Something I truly see no reason for. -- Happy Tcling, Andreas Kupries <and...@gm...> <https://core.tcl-lang.org/akupries/> <https://akupries.tclers.tk/> Developer @ SUSE Software Solutions Germany GmbH ------------------------------------------------------------------------------- |