Re: How to dynamically pass operators to if?
- From: Don Porter <dgp@xxxxxxxxxxxxxx>
- Date: 9 Mar 2006 04:20:13 GMT
Andrew Falanga writes:
if { $val1 $oper $val2 } {
Donald Arseneau wrote:
This used to work, long ago, but the round of expansion done by
[expr] (and its equivalents) was changed to perform substitution
of operands only, not operations or other syntax.
Can you say more about when that was?
At least as long as I've been using Tcl, the [expr] parser wants
operators present in the argument in order to determine the
structure of the expression. See this from version 7.4:
% info patch
7.4p3
% set op <
<
% set x 1
1
% set y 2
2
% if {$x $op $y} {puts 1} {puts 2}
syntax error in expression "$x $op $y"
This rule was in place long before it started making a performance
difference in Tcl 8.0.
--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@xxxxxxxx Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
.
- Follow-Ups:
- Re: How to dynamically pass operators to if?
- From: Donald Arseneau
- Re: How to dynamically pass operators to if?
- References:
- How to dynamically pass operators to if?
- From: Andrew Falanga
- Re: How to dynamically pass operators to if?
- From: Donald Arseneau
- How to dynamically pass operators to if?
- Prev by Date: too many nested evolutions (infinite loop?) at TK8.4.12 Bytecode
- Next by Date: Re: too many nested evolutions (infinite loop?) at TK8.4.12 Bytecode
- Previous by thread: Re: How to dynamically pass operators to if?
- Next by thread: Re: How to dynamically pass operators to if?
- Index(es):
Relevant Pages
|