|
From: avl <av...@lo...> - 2017-02-14 10:23:53
|
Florent Merlet <pos...@fl...> wrote:
> > Speaking of new magic symbols, say "#":
> > expr {#var = 9} and also expr {#sin(0) = 9}
> > might work. Any suggestions for a better symbol than "#"?
> $ ?
I wrote "new magic symbol", not re-adapting an existing one.
"$" is just wrong here in that it already means: pick the
value of that variable, rather than use this variable.
> a type ?
> expr {int sin(0) = 9}
Ways too far fetched for now. We just don't have types at
script level.
> reverse the notation ?
> expr {= sin(0) 9}
nope
> : ?
> expr {:sin(0) = 9}
expr {$cond ? :sin(0)=42 : :sin(1)=54} ... nope
Peter S <pet...@gm...> wrote:
> And besides, it's entirely unnecessary, as
> expr { {sin\(0)} = 1 }
> ...should work fine already.
for some strange definition of "fine". ;-)
% expr { {sin\(0)} = 1 } ;# <-- shell with TIP-282
1
% parray sin\\
sin\(0) = 1
"Dipl. Ing. Sergey G. Brester" <se...@us...> wrote:
> > Tcl's expressions are still parsed from left to right. You
> > cannot change the parsing syntax of terms based on operands
> > found lateron.
> Whats about token-char ")" in tcl variables substitution (by tokenize).
The topic was expr here, not how "set" interpretes its first argument
nor how the "..." within ${...} gets interpreted as var or array.
> > One possible approach would be principally accepting barewords
> Agree. That makes IMHO more sense as you suggestion below
But it cannot be extended to arrays that way.
> But would a pity, something like pointing resolvable varnames would be
> then impossible:
> expr {$varname = (...)}
Not necessarily. Operator "=" accepting a bareword does not exclude
it from also accepting expressions evaluating to varnames.
Whether it is something we *want* is an entirely different question
and I'd answer it with a "no", myself.
> > Speaking of new magic symbols, say "#":
> > expr {#var = 9} and also expr {#sin(0) = 9}
> > might work. Any suggestions for a better symbol than "#"?
> As already said, for me it is extremely ambiguous.
You might not like it, but it's not ambiguous in its
technical sense.
|