summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config/nimdoc.cfg4
-rw-r--r--lib/pure/collections/tables.nim27
-rw-r--r--todo.txt2
3 files changed, 20 insertions, 13 deletions
diff --git a/config/nimdoc.cfg b/config/nimdoc.cfg
index 7bb63ddaa..464c506c4 100644
--- a/config/nimdoc.cfg
+++ b/config/nimdoc.cfg
@@ -227,7 +227,6 @@ body {
   padding-top: 10%; }
 
 p.module-desc {
-  font-style: italic;
   font-size: 1.1em;
   color: #666666; }
 
@@ -559,7 +558,8 @@ pre {
 .pre {
   font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace;
   font-weight: 600;
-  color: #504da6; }
+  /*color: #504da6;*/
+}
 
 code {
   padding: 2px 4px;
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index 41dfdaca6..28b7fde92 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -1,14 +1,20 @@
 #
 #
 #            Nim's Runtime Library
-#        (c) Copyright 2013 Andreas Rumpf
+#        (c) Copyright 2014 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
 #
 
-## The ``tables`` module implements an efficient hash table that is
-## a mapping from keys to values.
+## The ``tables`` module implements variants of an efficient hash table that is
+## a mapping from keys to values. ``Table`` is the usual hash table,
+## ``OrderedTable`` is like ``Table`` but remembers insertion order
+## and ``CountTable`` is a mapping from a key to its number of occurances.
+## For consistency with every other data type in Nim these have **value**
+## semantics, this means that ``=`` performs a copy of the hash table.
+## For **reference** semantics use the ``Ref`` variant: ``TableRef``,
+## ``OrderedTableRef``, ``CountTableRef``.
 ##
 ## If you are using simple standard types like ``int`` or ``string`` for the
 ## keys of the table you won't have any problems, but as soon as you try to use
@@ -24,9 +30,15 @@
 ##
 ## What is happening here is that the types used for table keys require to have
 ## a ``hash()`` proc which will convert them to a `THash <hashes.html#THash>`_
-## value, and the compiler is listing all the hash functions it knows. After
-## you add such a proc for your custom type everything will work. See this
-## example:
+## value, and the compiler is listing all the hash functions it knows.
+## Additionally there has to be a ``==`` operator that provides the same
+## semantics as its corresponding ``hash`` proc.
+##
+## After you add ``hash`` and ``==`` for your custom type everything will work.
+## Currently however ``hash`` for objects is not defined, whereas
+## ``system.==`` for objects does exist and performs a "deep" comparison (every
+## field is compared) which is usually what you want. So in the following
+## example implementing only ``hash`` suffices:
 ##
 ## .. code-block::
 ##   type
@@ -51,9 +63,6 @@
 ##   p2.firstName = "소진"
 ##   p2.lastName = "박"
 ##   salaries[p2] = 45_000
-##
-## **Note:** The data types declared here have *value semantics*: This means
-## that ``=`` performs a copy of the hash table.
 
 import
   hashes, math
diff --git a/todo.txt b/todo.txt
index 330d68d9b..72bf89940 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,8 +1,6 @@
 version 0.10
 ============
 
-- document the tables module better
-
 - The bitwise 'not' operator will be renamed to 'bnot' to
   prevent 'not 4 == 5' from compiling. -> requires 'mixin' annotation for procs!
 - A named tuple will be compatible to a tuple with different names.