Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2010-01-18
16:51 • Closed ticket [2932421fff]: Overeager String conversion in format %s plus... artifact: 68d2e9b3b6 user: dkf
16:32 • Ticket [2932421fff]: 4 changes artifact: 9fb34a2b51 user: dkf
09:02 • Ticket [2932421fff]: 1 change artifact: 686819f5d6 user: dkf
08:45 • Ticket [2932421fff]: 2 changes artifact: 77930e5a9d user: ferrieux
08:34 • Ticket [2932421fff]: 5 changes artifact: 70b0a40f55 user: ferrieux
08:33 • Ticket [2932421fff]: 4 changes artifact: 0da16ac1d6 user: ferrieux
08:33 • Add attachment format.patch to ticket [2932421fff] artifact: 6a616790c0 user: ferrieux
2010-01-14
23:01 • New ticket [2932421fff] Overeager String conversion in format %s . artifact: 6f8ebc4994 user: ferrieux

Overeager String conversion in [format %s]

Closed / Fixed2932421fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 17 years ago
Descriptionplain2010-01-14 23:01:30
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.
ferrieuxplain2010-01-18 08:33:18
File Added - 359303: format.patch
ferrieuxplain2010-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 Ticket [2932421fff]: 2 changes [History diff]2010-01-18 08:45:05
dkf Ticket [2932421fff]: 1 change [History diff]2010-01-18 09:02:44
dkfplain2010-01-18 16:32:05
Applied to HEAD.
dkfplain2010-01-18 16:51:39
allow_comments - 1

and to 8.5 (no test there)
Log in (anonymous is fine) to add a comment.

Attachments: