Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Tcl man page omits ${array(key)} syntax

Closed / Fixed2538432fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2009-01-26 19:56:11
The Tcl man page entry #8 Variable Subsitution says:
------------
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). 
$name(index) 
Name gives the name of an array variable and index gives the name of an element within that array. Name must contain only letters, digits, underscores, and namespace separators, and may be an empty string. Command substitutions, variable substitutions, and backslash substitutions are performed on the characters of index. 
${name} 
Name is the name of a scalar variable. It may contain any characters whatsoever except for close braces.
----------------
It is also legal to put a whole array reference in braces: ${array(xxx)}. I believe the man page leaves the opposite impression.  A second line showing an array element in braces would correct this misleading omission.
dkf Ticket [2538432fff]: 3 changes [History diff]2009-01-27 05:47:14
dgpplain2009-01-27 06:20:52
a "whole array reference" is the
name of a scalar variable.
royterryplain2009-01-27 07:30:25
e Don's comment. Yes I know that a(xx) is the name of a scaler. I am suggesting a small change to make this more obvious to newcomers, etc. ASIDE: Actually it's odd to think what is a Tcl non-scaler variable. IOW, does the "scaler" language here add much?
dkfplain2009-05-04 01:06:07
allow_comments - 1

Clarified.
Log in (anonymous is fine) to add a comment.