Tcl Source Code

View Ticket
Login
Ticket UUID: 587145
Title: spaces in compiled expressions
Type: Bug Created on: 2002-07-26 17:22:28
Submitter: msofer Assigned to: msofer
Subsystem: 47. Bytecode Compiler Severity:
Priority: 5 Medium Last modified: 2002-07-27 00:28:47
Status: Closed Closed by: hobbs
Resolution: Invalid Closed on: 2002-07-26 17:28:47
Version: None
Description:
% set x {+ 1}
+ 1
% expr {$x + 1}
can't use non-numeric string as operand of "+"
% expr $x + 1
2
User Comments:
andreas_kupries added on 2002-07-27 00:27:43:
Logged In: YES 
user_id=75003

This is not a bug but the expected behaviour. $x is a non-
numeric string, and braced expressions $x is a atom in the 
expression, and not interpolated into it. This is also the 
difference between

set op +
expr {1 $op 3}    (a)
expr 1 $op 3

op is not recognized in (a).

hobbs added on 2002-07-27 00:28:47:
Logged In: YES 
user_id=72656

I concur with aku.