Skip to content
Tcl Source Code View Ticket
Login

View Ticket

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: