On 07/08/2017 16:15, rene wrote:
> why is in tcl8.6.5 "?" a valid array name but $?(..) doesn't work?
Because the brace-free form of $ doesn't syntactically support “?” (or
any number of other characters, such as π or Ω or «») as a variable
name; variables actually support more than $ in their names. The
restriction is not usually a problem, though I admit I'd quite like to
have Greek alphabetics when doing something fairly mathematical. :-)
The braced form of $ requires the braces to go round the whole variable
name, including the array element part.
These are all purely syntactic restrictions that stem from trade-offs in
parsing of your script. The underlying variable access APIs can accept
most characters as variable names, subject to the restriction that a
sequence of two-or-more colons is special and parentheses really should
only be used for indicating array name/element name separation.
Donal.
--
Donal Fellows — Tcl user, Tcl maintainer, TIP editor.