summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-06-10 00:39:19 +0200
committerGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-06-10 00:39:19 +0200
commitaf6abac4911be18bd92a9190ccbe39aa72ab1a79 (patch)
tree57f2c8c1c1da9a4ffc680c9e31238d5ace386abb /lib/pure
parent3f9ad7ef22dfea8fa58c378322581ab3b2ff48b2 (diff)
downloadNim-af6abac4911be18bd92a9190ccbe39aa72ab1a79.tar.gz
Revert "Adds to tables module example of reference type vs value type."
This reverts commit bde9d1ac0753e46c726dc63930539bb82d09f19d.
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/collections/tables.nim34
1 files changed, 2 insertions, 32 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index e51a04dd1..b5fc1737a 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -52,25 +52,8 @@
 ##   p2.lastName = "박"
 ##   salaries[p2] = 45_000
 ##
-## **Note:** The data types declared here starting with the **T** prefix have
-## *value semantics*: This means that ``=`` performs a copy of the hash table.
-## On the other hand, types declared with the **P** prefix have *reference
-## semantics*. Behaviour comparison:
-##
-## .. code-block:: nimrod
-##   var valueWords = initTable[string, string]()
-##   valueWords["teh"] = "the"
-##   var valueWordsClone = valueWords
-##   # Changing the clone won't change the original.
-##   valueWordsClone["teh"] = "thehehe"
-##   assert valueWords["teh"] != valueWordsClone["teh"]
-##
-##   var refWords = newTable[string, string]()
-##   refWords["teh"] = "the"
-##   var refWordsShadow = refWords
-##   # Both the shadow and the original share the same data.
-##   refWordsShadow["teh"] = "thehehe"
-##   assert refWords["teh"] == refWordsShadow["teh"]
+## **Note:** The data types declared here have *value semantics*: This means
+## that ``=`` performs a copy of the hash table.
 
 import
   hashes, math
@@ -878,16 +861,3 @@ when isMainModule:
   s2[p2] = 45_000
   s3[p1] = 30_000
   s3[p2] = 45_000
-
-  # Ref verification.
-  var valueWords = initTable[string, string]()
-  valueWords["teh"] = "the"
-  var valueWordsClone = valueWords
-  valueWordsClone["teh"] = "thehehe"
-  assert valueWords["teh"] != valueWordsClone["teh"]
-
-  var refWords = newTable[string, string]()
-  refWords["teh"] = "the"
-  var refWordsShadow = refWords
-  refWordsShadow["teh"] = "thehehe"
-  assert refWords["teh"] == refWordsShadow["teh"]