Tcl Source Code

Check-in [18138fd96f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:* doc/dict.n (dict with): [Bug 3474512]: Explain better what is going on when a dictionary key and the dictionary variable collide.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 18138fd96fd45d710af84337e3f22366afa405f4
User & Date: dkf 2012-01-17 15:22:55
Context
2012-01-21
08:20
Prevent buffer read overflow. Thanks to "sebres" for the report and fix check-in: 3cb2ac8fbd user: jan.nijtmans tags: trunk
2012-01-17
15:22
* doc/dict.n (dict with): [Bug 3474512]: Explain better what is going on when a dictionary key and t... check-in: 18138fd96f user: dkf tags: trunk
15:17
* doc/dict.n (dict with): [Bug 3474512]: Explain better what is going on when a dictionary key and t... check-in: 7c568a9106 user: dkf tags: core-8-5-branch
14:34
merge mark check-in: 003418bc2c user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2012-01-13  Donal K. Fellows  <[email protected]>

	* library/http/http.tcl (http::Connect): [Bug 3472316]: Ensure that we
	only try to read the socket error exactly once.

2012-01-12  Donal K. Fellows  <[email protected]>

>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2012-01-17  Donal K. Fellows  <[email protected]>

	* doc/dict.n (dict with): [Bug 3474512]: Explain better what is going
	on when a dictionary key and the dictionary variable collide.

2012-01-13  Donal K. Fellows  <[email protected]>

	* library/http/http.tcl (http::Connect): [Bug 3472316]: Ensure that we
	only try to read the socket error exactly once.

2012-01-12  Donal K. Fellows  <[email protected]>

Changes to doc/dict.n.

247
248
249
250
251
252
253









254
255
256
257
258
259
260
it is recommended that this command only be used in a local scope
(\fBproc\fRedure, lambda term for \fBapply\fR, or method). Because of
this, the variables set by \fBdict with\fR will continue to
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.









.RE
.SH "DICTIONARY VALUES"
.PP
Dictionaries are values that contain an efficient, order-preserving
mapping from arbitrary keys to arbitrary values.
Each key in the dictionary maps to a single value.
They have a textual format that is exactly that of any list with an







>
>
>
>
>
>
>
>
>







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
it is recommended that this command only be used in a local scope
(\fBproc\fRedure, lambda term for \fBapply\fR, or method). Because of
this, the variables set by \fBdict with\fR will continue to
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
Dictionaries are values that contain an efficient, order-preserving
mapping from arbitrary keys to arbitrary values.
Each key in the dictionary maps to a single value.
They have a textual format that is exactly that of any list with an
384
385
386
387
388
389
390










391
392
393
394
395
396
397

sumDictionary myDict
#    prints: \fIlast total was 15, for key b\fR

puts "dictionary is now \\"$myDict\\""
#    prints: \fIdictionary is now "a {total 6} b {total 15}"\fR
.CE










.SH "SEE ALSO"
append(n), array(n), foreach(n), incr(n), list(n), lappend(n), set(n)
.SH KEYWORDS
dictionary, create, update, lookup, iterate, filter
'\" Local Variables:
'\" mode: nroff
'\" End:







>
>
>
>
>
>
>
>
>
>







393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416

sumDictionary myDict
#    prints: \fIlast total was 15, for key b\fR

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
dictionary, create, update, lookup, iterate, filter
'\" Local Variables:
'\" mode: nroff
'\" End: