Re: Variable naming
- From: "mjanssen" <mpc.janssen@xxxxxxxxx>
- Date: 27 Sep 2006 14:17:03 -0700
mjanssen wrote:
Dario D. wrote:
Hello all,
Is slash (/) allowed in variable names? I'm reading a tutorial on the
NS2 simulator, and it appears to be using slashes in class names:
set tcp [new Agent/TCP]
I tried to run the following example through tclsh, but as you can see
it didn't work out well:
% set test/blah 5
5
% puts $test/blah
can't read "test": no such variable
Yes / is allowed in variable names. However, you do have to take a bit
care when getting the value with $. Not all the values that are valid
in a variable name, are valid in a $ expansion without braces. For the
exact rules see the Dodekalogue (http://wiki.tcl.tk/10259) rule 8.
For 8.4, I should of course have refered to the Endekalogue included in
the Tcl man page (http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm) rule 7.
Mark
.
- References:
- Re: Variable naming
- From: mjanssen
- Re: Variable naming
- Prev by Date: Re: Variable naming
- Next by Date: no irc in tcllib?
- Previous by thread: Re: Variable naming
- Next by thread: Re: Variable naming
- Index(es):
Relevant Pages
|