[erlang-questions] Noddy question on hashing

Motiejus Jakštys desired.mta@REDACTED
Thu Jul 25 22:06:12 CEST 2013


On Thu, Jul 25, 2013 at 7:38 PM, Siraaj Khandkar <siraaj@REDACTED> wrote:
> On 07/25/2013 05:52 AM, Rick Payne wrote:> Hi,
>
> If you're interested in correctness and want those attributes to be
> enums - you could use atoms as values and tell Dialyzer what each is
> expected to be, like so:
>
>     -type attribute_a() :: a
>                          | b
>                          | c
>                          .
>
>     -type attribute_b() :: d
>                          | e
>                          | f
>                          .
>
>     -record(object,
>         { a :: attribute_a()
>         , b :: attribute_b()
>         })
>
>     -type object() :: #object{}.
>

Note that once you have 13 or 14 of them they will just be reduced to 'atom()':
http://erlang.org/pipermail/erlang-questions/2012-August/068851.html

Motiejus



More information about the erlang-questions mailing list