diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-01-22 12:13:17 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-01-22 12:13:17 (GMT) |
commit | b96fd52bcba33e8f663042cd073454aa954723a8 (patch) | |
tree | f8e7b570982f2b528ff94f6e3389ec228acc95c0 /doc/dict.n | |
parent | 7a28ca58d78656d8cac01cff71138f393cb52b5d (diff) | |
parent | 4aed2bc2cd16fef4ffe748ec35725686038a4fbb (diff) | |
download | tcl-b96fd52bcba33e8f663042cd073454aa954723a8.zip tcl-b96fd52bcba33e8f663042cd073454aa954723a8.tar.gz tcl-b96fd52bcba33e8f663042cd073454aa954723a8.tar.bz2 |
merge from 8.5 main branch
Diffstat (limited to 'doc/dict.n')
-rw-r--r-- | doc/dict.n | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -227,6 +227,15 @@ exist after the command finishes (unless explicitly \fBunset\fR). Note that the mapping of values to variables does not use traces; changes to the \fIdictionaryVariable\fR's contents only happen when \fIbody\fR terminates. +.PP +If the \fIdictionaryVariable\fR contains a value that is not a dictionary at +the point when the \fIbody\fR terminates (which can easily happen if the name +is the same as any of the keys in dictionary) then an error occurs at that +point. This command is thus not recommended for use when the keys in the +dictionary are expected to clash with the \fIdictionaryVariable\fR name +itself. Where the contained key does map to a dictionary, the net effect is to +combine that inner dictionary into the outer dictionary; see the +\fBEXAMPLES\fR below for an illustration of this. .RE .SH "DICTIONARY VALUES" .PP @@ -364,6 +373,16 @@ sumDictionary myDict puts "dictionary is now \\"$myDict\\"" # prints: \fIdictionary is now "a {total 6} b {total 15}"\fR .CE +.PP +When \fBdict with\fR is used with a key that clashes with the name of the +dictionary variable: +.PP +.CS +set foo {foo {a b} bar 2 baz 3} +\fBdict with\fR foo {} +puts $foo +# prints: \fIa b foo {a b} bar 2 baz 3\fR +.CE .SH "SEE ALSO" append(n), array(n), foreach(n), incr(n), list(n), lappend(n), set(n) .SH KEYWORDS |