Tcl Source Code

View Ticket
Login
Ticket UUID: 2932421
Title: Overeager String conversion in [format %s]
Type: Bug Version: obsolete: 8.6b1
Submitter: ferrieux Created on: 2010-01-14 23:01:30
Subsystem: 44. UTF-8 Strings Assigned To: dkf
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2010-01-18 16:51:39
Resolution: Fixed Closed By: dkf
    Closed on: 2010-01-18 09:51:39
Description:
As described in

http://groups.google.com/group/comp.lang.tcl/tree/browse_frm/thread/1eb1932e16e25422/5cc54e913d84ec4b?rnum=1&_done=%2Fgroup%2Fcomp.lang.tcl%2Fbrowse_frm%2Fthread%2F1eb1932e16e25422%2Fb2ca7ba01ad9bef4%3F#doc_5cc54e913d84ec4b

[format %s] converts its object argument to tclStringType, due to generic handling of optional with specifiers.
 This is unnecessary, concatenation and char counting can very well be done at the string rep level (modified UTF-8), thus avoiding many cases of undue shimmering.

Note that [append] does the same, but the shimmering is unavoidable, since the result's internal repr is invalidated by appending.
User Comments: dkf added on 2010-01-18 16:51:39:

allow_comments - 1

and to 8.5 (no test there)

dkf added on 2010-01-18 16:32:05:
Applied to HEAD.

ferrieux added on 2010-01-18 08:34:55:
The attached patch fixes the unwanted force-to-String of inputs, which was due to char counting done even when not needed.

Note that the *output* of [format %s] is still a String object, but that's another story.

ferrieux added on 2010-01-18 08:33:18:

File Added - 359303: format.patch

Attachments: