Re: Quoted substitution
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Quoted substitution

From: Joe English <jenglish@flightlab.com>
Date: Sat Dec 17 2005 - 18:49:33 CET

Ian Bell wrote:
>
>[...] I suppose what concerns me is that Prof Ousterhout says:
>
>'First, you must learn Tcl syntax, which consists of about half a dozen
>rules that determine how commands are parsed'
>
>and
>
>'The first form of substitution is variable substitution and it is triggered
>by a dollar sign character and it causes the value of a Tcl variable to be
>inserted into a word.'
>
>Neither of which gives a hint at the special case of $$.

That's not a special case. Rule 5 sez:

| Variable substitution may take any of the following forms:
|
| $name Name is the name of a scalar variable; the name
| is a sequence of one or more characters that are
| ^^^^^^^^^^^
| a letter, digit, underscore, or namespace separators
| (two or more colons).
|
| [... followed by two other rules ...]

So in "$$a", the first $ isn't a variable reference,
since it's followed by zero name characters.

>I guess my concern is that there may be other special cases or a least an
>unpublished rule.

Don't go by tutorials or introductory documents; those usually
leave out a lot of the low-level details. The manpage Tcl(n)
specifies things precisely. [*]

--Joe English

  [*] Well, mostly :-)
Received on Fri Dec 23 19:01:54 2005