Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-07-31
06:32 • Closed ticket [446017ffff]: uplevel bug for rare case scenario plus 9 other ... artifact: 4dbf6d741a user: msofer
2001-07-30
17:26 • New ticket [446017ffff]. artifact: f5c7c5b573 user: hemanglavana

uplevel bug for rare case scenario

Closed / Invalid446017ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-07-30 17:26:21
When only one argument is passed to uplevel command and if the first letter is a # sign, then tcl 
reports an error:

godel> tclsh
%info patch
8.3.3
% proc #123 {args} {puts args=$args}
% uplevel [list #123 hello world]
expected integer but got "123 hello world"
% uplevel 0 [list #123 hello world]
args=hello world
% exit

The current workaround is to explicitly specify the _level_ argment to uplevel command.

Hemang.
msoferplain2001-07-31 06:32:45
Logged In: YES 
user_id=148712

This is the behaviour documented in the man pages:
"If level consists of # followed by a number then the number
gives an
absolute level number. If level is omitted then it defaults
to 1. Level
cannot be defaulted if the first command argument starts
with a digit or
#."

For performance reasons you should try not to omit the level
if you are
passing a command assembled with [list] to [uplevel]: if you
do,
Tcl_UplevelObjCmd will get the string rep of the list,
thereby defeating
the "pure list optimisation".

Note that (assuming 'cmd' does not start with a digit or #),
   uplevel cmd ?arg?
is equivalent to
   uplevel 1 cmd ?arg?
Log in (anonymous is fine) to add a comment.