From ed71ea35bad9a511125c82ce42160cad9fa8311f Mon Sep 17 00:00:00 2001
From: Guilherme Andrade
Date: Sat, 25 Feb 2017 22:00:17 +0000
Subject: Reject unsafe matchspecs on ets:select_replace/2
Preemptively fail operation with badarg if the replacement object
might have a different key.
---
lib/stdlib/doc/src/ets.xml | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
(limited to 'lib/stdlib/doc/src')
diff --git a/lib/stdlib/doc/src/ets.xml b/lib/stdlib/doc/src/ets.xml
index 3e9ad89b26..29d22ffae5 100644
--- a/lib/stdlib/doc/src/ets.xml
+++ b/lib/stdlib/doc/src/ets.xml
@@ -1492,25 +1492,21 @@ is_integer(X), is_integer(Y), X + Y < 4711]]>
- Match the objects in an ETS table against a match_spec and
- replaces matching objects with the match_spec result
+ Match and replace objects atomically in an ETS table
For the moment, due to performance and semantic constraints,
tables of type bag are not yet supported.
Matches the objects in the table Tab using a
- match_spec. If the
- an object is matched, and the match_spec result is an object with the
- same key, the existing object is replaced with the match_spec result.
- For any other result from the match_spec the object is kept
- unchanged.
- The function returns the number of objects actually
- replaced in the table.
+ match specification. If the
+ an object is matched, the existing object is replaced with
+ the match specificatoin result.
+ The function returns the total number of replaced objects.
- The match_spec has to return an object with the same key if
- the object is to be replaced. No other return value will get the
- object replaced.
+ If there's a risk a match specification might return
+ a tuple with a different key, the whole operation will fail
+ with badarg.
--
cgit v1.2.3