summary refs log tree commit diff stats
path: root/lib/pure/collections
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2020-07-25 09:53:47 +0200
committerGitHub <noreply@github.com>2020-07-25 09:53:47 +0200
commit1330597f6df1d2f7d23ec25a7705e21be2e78d29 (patch)
tree1a0ad0a8b2258e3be9107aaf88be2a44cf450e09 /lib/pure/collections
parent2dddf32726a1472d322644ec1a66caf8c547360e (diff)
downloadNim-1330597f6df1d2f7d23ec25a7705e21be2e78d29.tar.gz
deprecate tables.add (#15047)
Diffstat (limited to 'lib/pure/collections')
-rw-r--r--lib/pure/collections/tables.nim12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index cf864c640..a8742bdbe 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -484,7 +484,8 @@ proc len*[A, B](t: Table[A, B]): int =
 
   result = t.counter
 
-proc add*[A, B](t: var Table[A, B], key: A, val: B) =
+proc add*[A, B](t: var Table[A, B], key: A, val: B) {.deprecated:
+    "Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
   ## Puts a new ``(key, value)`` pair into ``t`` even if ``t[key]`` already exists.
   ##
   ## **This can introduce duplicate keys into the table!**
@@ -962,7 +963,8 @@ proc len*[A, B](t: TableRef[A, B]): int =
 
   result = t.counter
 
-proc add*[A, B](t: TableRef[A, B], key: A, val: B) =
+proc add*[A, B](t: TableRef[A, B], key: A, val: B) {.deprecated:
+    "Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
   ## Puts a new ``(key, value)`` pair into ``t`` even if ``t[key]`` already exists.
   ##
   ## **This can introduce duplicate keys into the table!**
@@ -1448,7 +1450,8 @@ proc len*[A, B](t: OrderedTable[A, B]): int {.inline.} =
 
   result = t.counter
 
-proc add*[A, B](t: var OrderedTable[A, B], key: A, val: B) =
+proc add*[A, B](t: var OrderedTable[A, B], key: A, val: B) {.deprecated:
+    "Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
   ## Puts a new ``(key, value)`` pair into ``t`` even if ``t[key]`` already exists.
   ##
   ## **This can introduce duplicate keys into the table!**
@@ -1935,7 +1938,8 @@ proc len*[A, B](t: OrderedTableRef[A, B]): int {.inline.} =
 
   result = t.counter
 
-proc add*[A, B](t: OrderedTableRef[A, B], key: A, val: B) =
+proc add*[A, B](t: OrderedTableRef[A, B], key: A, val: B) {.deprecated:
+    "Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
   ## Puts a new ``(key, value)`` pair into ``t`` even if ``t[key]`` already exists.
   ##
   ## **This can introduce duplicate keys into the table!**