|
From: avl <av...@lo...> - 2017-02-14 21:24:33
|
Donald Porter <d.g.porter@co...> wrote:
> On Feb 14, 2017, at 10:48 AM, avl <avl@...> wrote:
> > When compiling an expression like {sin(0)=42}, then at the time the "=" is
> > seen, the bytecode for calling [tcl::mathfunc::sin 0] is already produced.
> This is mistaken.
I plead guilty for oversimplification. Sorry.
> The entire expression is parsed into a parse-tree data structure.
Anyway, the "=" node of the parsetree already has a "left" sub-tree
representing the *parsed* left operand and it seems like a far fetch
to me that if this subtree represents a function call that it would be
morphed into an alternative parse-tree that represents an array element
having all the previously call arguments [join ... ","]ed for the index.
Other structures on left side would not be morphed, so {sin(0)+1=1}
would actually assign to variable "2.0", but {sin(0)=1} would assign
to element 0 of array sin ... weird - and not so much for assigning to
sin(0)+1, but for allowing all kinds of expressions to evaluate to the
target variable, *except* direct function-calls.
Also, the aspect of arr(1+1) on left side of "=" meaning something
different than $arr(1+1) on right side has already been raised, but
maybe $arr(1+1) *within expr* would be changed as well, then requiring
at least consistent quoting for literal array indexes throughout all
expr? (-> Tcl9 or even 10)
|