summaryrefslogtreecommitdiffstats
path: root/doc/DictObj.3
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-11-20 20:43:08 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-11-20 20:43:08 (GMT)
commit69ece03dc014b44e93da9576bb02d060b202013b (patch)
treeb18999bb6907a1311f4eb7808445c05911198c15 /doc/DictObj.3
parent0500cb0762976df7a95232b162dbb09d7876d0ea (diff)
downloadtcl-69ece03dc014b44e93da9576bb02d060b202013b.zip
tcl-69ece03dc014b44e93da9576bb02d060b202013b.tar.gz
tcl-69ece03dc014b44e93da9576bb02d060b202013b.tar.bz2
* generic/tclDictObj.c: Changed the underlying implementation of the
hash table used in dictionaries to additionally keep all entries in the hash table in a linked list, which is only ever added to at the end. This makes iteration over all entries in the dictionary in key insertion order a trivial operation, and so cleans up a great deal of complexity relating to dictionary representation and stability of iteration order.
Diffstat (limited to 'doc/DictObj.3')
-rw-r--r--doc/DictObj.316
1 files changed, 10 insertions, 6 deletions
diff --git a/doc/DictObj.3 b/doc/DictObj.3
index 20d3514..4e72a1c 100644
--- a/doc/DictObj.3
+++ b/doc/DictObj.3
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: DictObj.3,v 1.9 2007/06/29 22:37:27 dkf Exp $
+'\" RCS: @(#) $Id: DictObj.3,v 1.10 2007/11/20 20:43:11 dkf Exp $
'\"
.so man.macros
.TH Tcl_DictObj 3 8.5 Tcl "Tcl Library Procedures"
@@ -99,9 +99,14 @@ sub-dictionaries of the main dictionary object passed to them.
.SH DESCRIPTION
.PP
Tcl dictionary objects have an internal representation that supports
-efficient mapping from keys to values and which does not guarantee any
-particular ordering of keys within the dictionary (the underlying
-basic data-structure is a hash table created with \fBTcl_InitObjHashTable\fR).
+efficient mapping from keys to values and which guarantees that the
+particular ordering of keys within the dictionary remains the same
+modulo any keys being deleted (which removes them from the order) or
+added (which adds them to the end of the order). If reinterpreted as a
+list, the values at the even-valued indices in the list will be the
+keys of the dictionary, and each will be followed (in the odd-valued
+index) bu the value associated with that key.
+.PP
The procedures described in this man page are used to
create, modify, index, and iterate over dictionary objects from C code.
.PP
@@ -190,7 +195,7 @@ keys must exist and have dictionaries as their values.
.SH EXAMPLE
Using the dictionary iteration interface to search determine if there
is a key that maps to itself:
-
+.PP
.CS
Tcl_DictSearch search;
Tcl_Obj *key, *value;
@@ -225,7 +230,6 @@ for (; done ; \fBTcl_DictObjNext\fR(&search, &key, &value, &done)) {
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(!done));
return TCL_OK;
.CE
-
.SH "SEE ALSO"
Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_InitObjHashTable
.SH KEYWORDS