upvar sugar

Richard Suchenwirth 1999-07-21 -- I have proposed to use a style of Tcl more closer to natural English (so-called "sugared Tcl", see Salt and Sugar) for the control layer of complex software systems. A Tcl-controlled application really gets efficient when running compiled C code. Registering such a compiled command with Tcl, for example the trivial C function

   int foo_add (int a, int b) {return (a+b);}

would lead to a Tcl command to be called like

   set c [foo_add $a $b]

with the typical dollars and brackets. "Sugaring", as understood here, would mean another layer around it:

   proc foo:add {_a and _b to _c} {
        upvar $_a a $_b b $_c c
        set c [foo_add $a $b]
   }

which admittedly is not very close to natural language, but finally allows calling

   foo:add a and b to c

or even, for COBOL lovers (sugar arguments may be any string you want)

   foo:add a to b giving c

The cost of such cosmetics is one more level in the call stack, loss of flexibility (you may not place integer constants, or function calls, at the upvared positions), wasted time and wasted bytes. Is it really wasted? If we want a self-documenting configuration language but do NOT use Tcl, what then?