Version 0 of Rules for the names of variables

Updated 2005-04-18 17:33:12 by LES

LES: The Endekalogue already provides some rules for the names of variables, but I thought this topic could be useful to clarify a few more details, especially to newcomers because Tcl allows a lot of liberty with the names of variables.

Since I am Brazilian and my language has more than 26 characters, I will begin with a few observations I have made in relation to special characters:

  • Tcl allows spaces in variable names. You just need to wrap the name with the brackets:
 % set {some variable name} 2
 % set {some variable name}
 2
 % puts ${some variable name}
 2
  • Tcl also allows special characters, so long as these are also wrapped in brackets:
 % set !@weird¬* "yikes!"
 % set !@weird¬*
 yikes!
 % puts ${!@weird¬*}
 yikes!

 % set acentuação "sim!"
 % set acentuação
 sim!
 % puts ${acentuação}
 sim!

Unfortunately, the cedilla and/or accented vowels are not considered "normal" characters. I could really swear it was not like that until not too long ago. But I am probably mistaken. Anyway, it's still better than most languages.

Still editing...