Erlang 17 recommend to use map replace record,but

2019-04-11 04:36发布

In joe's "Big changes to Erlang" http://joearms.github.io/2014/02/01/big-changes-to-erlang.html

"we wanted maps to be a replacement for records and to be as efficient as records, and its not blindingly obvious how to do so."

How to make transform records to maps in mnesia?

标签: map erlang
1条回答
Animai°情兽
2楼-- · 2019-04-11 05:37

Mnesia uses ETS (and dets) internally and these are based on tuples as the base data structure. While they can contain maps at the top-level it must be tuples. As records are tuples records can also be at the top-level. Redesigning ets/dets/mnesia to use maps would be a major effort.

As maps access is done dynamically while records statically it is probably not possible to get maps as fast as records.

查看更多
登录 后发表回答