Re: Syntax, expressiveness and the beauty of Tcl





On Oct 30, 3:33 pm, Christian Gollwitzer
<Christian.Gollwit...@xxxxxxxxxxxxxxx> wrote:
Stephan Kuhagen wrote:
One point on the wiki-page was the syntax for math expressions like

x=a+b

in a "normal" language (whatever this means) which is

set x [expr $a+$b]I also dislike expr in Tcl, if one has to do lots of math. Especially
that in 99% cases one needs to use additional braces. Set is OK. I'd
like to have a syntax like

${something}

as an equivalent to [expr {something}]

So one could write

set a ${$b+7}

to get this more compact. However, this not possible in Tcl withou
changing the language...

Christian

Note that there is a backward compatibility problem with using $ for
this. The reason is that in Tcl {$b+7} is a perfectly valid variable
name.
So you will run into problems:

% set {$b+7} 5
5
% set b 1
1
% set a ${$b+7}
# a == 5 (current Tcl)
# a == 8 (with this syntax)

Mark

.