Re: Syntax, expressiveness and the beauty of Tcl



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
.



Relevant Pages

  • Re: Dangers of web apps written in Tcl
    ... is the nature of the language. ... with Tcl it might get evaluated. ... Now suppose he gives me an age of '': ... I fully accept the argument that you should put the operands for the expr in braces. ...
    (comp.lang.tcl)
  • Re: Dangers of web apps written in Tcl
    ... about Tcl's dynamic nature. ... is the nature of the language. ... with Tcl it might get evaluated. ... I fully accept the argument that you should put the operands for the expr in braces. ...
    (comp.lang.tcl)
  • Re: Dangers of web apps written in Tcl
    ... a little-language (expr) results in one more (unexpected to the ... beginner) round of evaluation than most other languages, ... first time I have to attack a web application written in Tcl I'll be ... Complex web apps typically take hundreds to user inputs and I think it's ...
    (comp.lang.tcl)
  • Re: Dangers of web apps written in Tcl
    ... have responded here) are not familiar with intricacies of expr. ... I originally suggested that there are dangers in writing web applications in Tcl because Tcl has unique characteristics that mean a bit of user supplied code can be executed by the application in ways that other languages don't offer. ... Donald pointed to an area where there might be a risk, which I demonstrated with a proof of concept, and which was further explored by Gerald Lester. ... how common and fundamental a check this is. ...
    (comp.lang.tcl)
  • Re: expr and security issues
    ... operation with expr and I am really surprised that, so far, nobody has jumped in the air and has cried out "Never use expr!". ... I am new to tcl, but I have always compared expr with the PHP function eval() which is considered evil because it can be used for code injection and other bad things if you don't care about proper input validation. ... within the confines of a Safe Interpreter. ...
    (comp.lang.tcl)