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

obsolete: 8.5.6
closed-fixed
5
2009-05-03
2009-01-26
Roy E Terry
No

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.

Discussion

    • labels: 104246 --> 45. Parsing and Eval
    • milestone: --> obsolete: 8.5.6
    • assigned_to: nobody --> msofer
     
  • Don Porter
    Don Porter
    2009-01-26

    a "whole array reference" is the
    name of a scalar variable.

     
  • Roy E Terry
    Roy E Terry
    2009-01-27

    re 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?

     
  • Clarified.

     
    • assigned_to: msofer --> dkf
    • status: open --> closed-fixed