Re: Question understanding variable expansion
On Jul 12, 9:02*pm, bmburst...@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.
That would happen in Bourne Shell, not in Tcl. To summarize this key
divergence:
- Sh: substitute, then tokenize
- Tcl: tokenize, then substitute
-Alex
|