Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix argument order of info/2 to be backwards compatible with ets

  • Loading branch information...
commit dc1c1a5b61a052cb90927aa0874cc65c0a295f26 1 parent 6f763ed
Richard Carlsson authored
Showing with 12 additions and 12 deletions.
  1. +6 −6 lib/stdlib/src/dict.erl
  2. +6 −6 lib/stdlib/src/orddict.erl
View
12 lib/stdlib/src/dict.erl
@@ -329,19 +329,19 @@ is_empty(Dict) -> size(Dict) =< 0.
info(Dict) ->
Items = [size,type],
- [info(Item, Dict) || Item <- Items].
+ [info(Dict, Item) || Item <- Items].
--spec info(InfoTag, Dict) -> Value when
+-spec info(Dict, InfoTag) -> Value when
+ InfoTag :: 'size' | 'type',
Dict :: dict(),
- InfoTag :: 'size' | 'type' | atom(),
Value :: term().
%% @doc Get information about a dictionary. This is a constant time
%% operation.
-info(size, Dict) -> size(Dict);
-info(type, #dict{}) -> set;
-info(type, ?gb(_,_)) -> ordered_set;
+info(Dict, size) -> size(Dict);
+info(#dict{}, type) -> set;
+info(?gb(_,_), type) -> ordered_set;
info(_, _) -> undefined.
-spec values(Dict) -> [Val] when
View
12 lib/stdlib/src/orddict.erl
@@ -163,7 +163,7 @@ is_empty(Dict) -> Dict =:= [].
-spec info(Orddict) -> [InfoTuple] when
Orddict :: orddict(),
InfoTuple :: {InfoTag, Value},
- InfoTag :: 'size' | 'type',
+ InfoTag :: 'size',
Value :: term().
%% @doc Get information about a dictionary. Returns a list of tagged tuples
@@ -171,18 +171,18 @@ is_empty(Dict) -> Dict =:= [].
%% Note that this takes time proportional to the number of elements.
info(Dict) ->
- Items = [size,type],
- [info(Item, Dict) || Item <- Items].
+ Items = [size],
+ [info(Dict, Item) || Item <- Items].
--spec info(InfoTag, Orddict) -> Value when
+-spec info(Orddict, InfoTag) -> Value when
+ InfoTag :: 'size',
Orddict :: orddict(),
- InfoTag :: 'size' | atom(),
Value :: term().
%% @doc Get information about a dictionary. Note that getting the size of an
%% orddict takes time proportional to the number of elements.
-info(size, Dict) -> size(Dict);
+info(Dict, size) -> size(Dict);
info(_, _) -> undefined.
-spec values(Orddict) -> [Val] when
Please sign in to comment.
Something went wrong with that request. Please try again.