Re: Syntax, expressiveness and the beauty of Tcl
- From: "Mark Janssen" <mpc.janssen@xxxxxxxxx>
- Date: 31 Oct 2006 01:16:19 -0800
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. Especiallythat 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
.
- References:
- Syntax, expressiveness and the beauty of Tcl
- From: Stephan Kuhagen
- Re: Syntax, expressiveness and the beauty of Tcl
- From: Christian Gollwitzer
- Syntax, expressiveness and the beauty of Tcl
- Prev by Date: starting a background process
- Next by Date: Re: write binary file with struct in tcl
- Previous by thread: Re: Syntax, expressiveness and the beauty of Tcl
- Next by thread: Re: Syntax, expressiveness and the beauty of Tcl
- Index(es):