Talk:Arithmetic evaluation: Difference between revisions

Prohibition is against a technique, not an operation.
(New section: [[Talk:Arithmetic Evaluator#TCL and [expr]|TCL and [expr]]])
(Prohibition is against a technique, not an operation.)
Line 5:
 
As is is written, this task is impossible in TCL since TCL has no concept of a "number" -- all variables are strings of bytes at the bottom and the only way to add a number to another one is to expressly declare some string to be interpreted as ... an expression. I.e. if variable "A" contains the string "3" then TCL has no idea that this might be a number. However [expr $A] would be a number (returned as a string again) and [expr $A+3] would be the string "6". Thus no matter how complicated my program might get, at some point I would <i>have to</i> invoke something like [expr $var1 $symbol $var2] (which would take the string formed by concatenating the contents of $var1, $symbol and $var2 and interpret them as an expression and return the result). This "bottom invocation", however would be prohibited by the task rules (and if I allow [expr] then I might as well just call [expr $original_string] and be done with the whole exercise in one line). Suggestions anybody? [[User:Sgeier|Sgeier]] 20:01, 22 January 2008 (MST)
:I have rephrased the task in an attempt to clarify that the prohibition is against relatively direct evaluation of the input. Evaluation of the results of parsing is expected, not prohibited. --[[User:TBH|TBH]] 09:37, 23 January 2008 (MST)
Anonymous user