[erlang-questions] maps or records?

Joe Armstrong <>
Mon Feb 29 22:23:50 CET 2016


On Fri, Feb 26, 2016 at 3:50 PM, Benoit Chesneau <> wrote:
> Hi all,
>
> i tends these days to use maps instead of records, so you dont' have to
> include a file to retrieve the "schema" but I wonder if this is a good idea
> or not. Is there still some usage for records vs maps?

It depends - what goals are you trying to achieve?

I can imaging different goals:

    - efficiency
    - clarity
    - speed of prototyping
    - ease of debugging

Depending upon what you want I'd chose different methods.
Records are the most efficient, but need a bit of tender loving care
when you modify code. Maps are great if you don't really know what keys
you want and are doing exploratory programming.

Perhaps you should start with maps and change the representation to records
when you fully understand your problem.

/Joe



>
> - benoît
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>


More information about the erlang-questions mailing list