Erlang 17 recommend to use map replace record,but how to make mnesia support map?

随声附和 提交于 2019-12-06 07:48:26

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/24988993/erlang-17-recommend-to-use-map-replace-record-but-how-to-make-mnesia-support-map

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!