Map相关的细节在EEP 43上，参见 这里。
A record replacement is just that, a replacement. It’s like asking the question, “What do we have?” instead of “What can we get?” The instant rebuttal would be “What do we need?” I say Maps.
The new data-type shall have semantics, syntax and operations that:
> provides an association set from key terms to value terms which can be constructed, accessed and updated using language syntax
> can be uniquely distinguished from every other data-type in the language
> has no compile-time dependency for constructing, accessing or updating contents of maps nor for passing maps between modules, processes or over Erlang distribution
> can be used in matching expressions in the language
> has a one-to-one association between printing and parsing the data-type
> has a well defined order between terms of the type and other Erlang types
> has at most O(log N) time complexity in insert and lookup operations, where N is the number of key-value associations.
思遥同学很贴心的写了一篇maps的分析，参看 Erlang 的新数据结构 map 浅析
Post Footer automatically generated by wp-posturl plugin for wordpress.