On Thursday, July 12, 2012 10:23:18 PM UTC+3, Eugene wrote:
> On 12.07.2012 23:02, bmburstein@gmail.com wrote:
> > Why does something crazy like this work
> >
> > set $x pu
> > set $y ts
> > $x$y hello
> >
> > outputs "hello", but neither of these work:
> >
> > set $x {puts hello}
> > $x
> >
> > or
> >
> > set $x[list puts hello]
> > $x
> >
> > I would think the variable substitution phase (as evident in the first example) would just replace the line `$x` with `puts hello`, and then run that line.
> First of all - 'set $x pu' doesn't work, and no wonder - there's no x
> defined. There's no need to use $ when you assign a value to a variable.
My mistake when typing it into the browser. I did it right in the actual tcl program.
> Second - if you want to put some command into a variable and then run
> it, expand it first:
> set cmd {puts hello!}
> {*}$cmd
Can you explain how exactly this works? What is {*}?
>
> --
> WBR, Eugene.