[erlang-questions] Re: Special syntax for dictionaries

Robert Virding rvirding@REDACTED
Sat May 8 16:46:44 CEST 2010


I think there is really only one reason why you would use records
instead of frames/structs: speed. Records will be faster as all the
work needed to find out which field to access is done at compile-time.
A secondary reason could be that you get some compile-time checking
which will catch typos. I would expect that dialyzer would be able to
catch some of those.

I personally would convert and use frames/structs when they arrive.

Robert

On 8 May 2010 13:37, Sergey Samokhin <prikrutil@REDACTED> wrote:
> Let's just *suppose* that frames/structs are already here.
>
> The question: are there any reasons why we would want to use records?
> In other words, should we now think of records as some kind of
> deprecated trick?
>
> To answer this question we should list features that only records have
> and then ask another question: "it this good to still have these
> features?".
>
> 1. With records you are restricted to declared keys. You can't add new
> keys on the fly.
>
> Are there situations when it's good?
>
> 2. With records you can specify default values to keys
>
> With frames it can'be achieved by using custom wrappers:
>
> create_my_frame(...) % Creates a new frame with all the default values specified
>
> --
> Sergey Samokhin
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list