Re: Syntax, expressiveness and the beauty of Tcl



On 30 Oct 2006 18:16:26 -0800,
"slebetman@xxxxxxxxx" <slebetman@xxxxxxxxx> wrote:

My personal favourite is to do [interp alias {} expr {} =] so I can
write: label .l -width [= 150+$a] -height [= $a+$b]

That might be viable if [interp alias] was able to, for example,
embed the arguments within the list instead of only appending them.

interp new-kinda-alias {} = {} expr { ${} }

Where ${} represents the command tail. Then, writing this:

set x [= 150+$a]

would be absolutely identical to writing:

set x [expr { 150+$a }]

and it'd actually do something useful. Although, I think we'd be
heading into very very dangerous waters with an interp command like
that... A new definition of the old [K] function:

interp new-kinda-alias {} K {} lindex [list ${}] end


Almost as dangerous as if you could warp the namespace resolution of
the TCL maths namespace, to include the namespace resolution of the
present execution scope. All of a sudden all your maths operations
would be exposed as regular commands, and probably your entire procedure
body would be written within a single [expr] statement, using
[expr] syntax parsing rules instead of the usual TCL rules.
Replace the [proc] command to wrap the procedure body in an [expr]
and suddenly TCL ends up looking very very odd. ;)


Fredderic
.



Relevant Pages