[erlang-questions] map elements in defined order

Attila Rajmund Nohl attila.r.nohl@REDACTED
Fri Oct 27 10:38:46 CEST 2017


2017-10-27 9:25 GMT+02:00 Ulf Wiger <ulf@REDACTED>:
[...]
> As evidenced e.g. by Benoit's comment above, I believe lots of people
> already rely on the order of map elements being IN SOME WAY stable. This is
> likely a brittle assumption, but one that may - in time - trap the OTP team
> into having to preserve the current APPARENT order.
>
> And the apparent order does appear to be sorted, as long as only maps of
> size =< 32 ("flatmaps") are inspected. For larger maps ("hashmaps"), the
> order of elements returned by maps:to_list/1 indeed appears arbitrary.

I already run into a bug where the code expected the map to be sorted.
When the 33rd element was added, it started to show pathological
behavior.



More information about the erlang-questions mailing list