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: Adrian Ho <tcl@03s.net>
Date: Mon Dec 19 2005 - 17:46:02 CET

On 2005-12-19, Donal K. Fellows <donal.k.fellows@manchester.ac.uk> wrote:
> Cameron Laird wrote:
>> 'Anyone have a concrete suggestion for a change to `man
>> Tcl`, or a good place on the Wiki to work this out?
>
> Change:
> If a word contains a dollar-sign (``$'') then Tcl performs \fIvariable
> substitution\fR: the dollar-sign and the following characters are
> replaced in the word by the value of a variable.
> to:
> If a word contains a dollar-sign (``$'') followed by one of the forms
> described below, then Tcl performs \fIvariable substitution\fR: the
> dollar-sign and the following characters are replaced in the word by
> the value of a variable.
>
> Minimal, but should stop this topic from coming up again.

A refinement:

If a word contains a dollar-sign (``$'') followed by one of the forms
described below, then Tcl performs \fIvariable substitution\fR: that
dollar-sign and the characters of that form are replaced in the word by
the value of the variable indicated by that form.

In other words, *only* the dollar-sign and characters that *together*
correspond to a variable de-reference are substituted -- everything
else is left untouched:

  % set a(b) 12345
  12345
  % puts $$a(b)c
  $12345c

Regards,
Adrian
Received on Fri Dec 23 19:02:14 2005