Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-04-15
19:42 • Closed ticket [721721ffff]: uplevel cmd has unnecesary string conversion p... artifact: fb90d8719c user: msofer
18:01 • Ticket [721721ffff]: 4 changes artifact: bd163b6578 user: nobody
10:24 • New ticket [721721ffff]. artifact: 6966287c20 user: nobody

[uplevel cmd] has unnecesary string conversion

Closed / Invalid721721ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-04-15 10:24:14
NB. this is not a true bug report....

The current implementation of [uplevel cmd]
(Tcl_UplevelObjCmd in tclProc.c) checks
"cmd" to see if it is a level number, even though
the docs indicate uplevel's syntax to be:
 uplevel ?level? cmd ?arg ...?
ie. if there is only one argument it has to be the cmd.
ie. it doesn't/shouldn't be checked to see if it is
a level number

I believe that this causes unnecesary shimmering
of 'cmd' as it is converted to a string to check to see
if it is a number.
nobodyplain2003-04-15 18:01:19
Logged In: NO 

Also consider the following:

% proc 22 {} {puts Hi!}
% proc Y {} { uplevel 22 }
% Y
bad level "22"
% uplevel
wrong # args: should be "uplevel ?level? command ?arg ...?"
% info tclversion
8.4

Now *this* is a bug.
msoferplain2003-04-15 19:42:15
Logged In: YES 
user_id=148712

That is documented behaviour, not a bug. The [uplevel] man
page says: "Level cannot be defaulted if the first command
argument starts with a digit or #."

Re shimmering: Tcl_Objs can have two simultaneous
representations: string and internal; computing the string
rep does not destroy the internal rep and does not really
qualify as "shimmering". Also, by their genesis, Tcl_Objs
representing commands always have a valid string rep.
Log in (anonymous is fine) to add a comment.