[erlang-questions] -spec tuple variable size

Motiejus Jakštys desired.mta@REDACTED
Wed Nov 28 22:50:03 CET 2012


On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov
<dmkolesnikov@REDACTED> wrote:
> but compiler fails syntax error before: ','
>
> -- CLIP --
> -type value()     :: string() | binary() | number() | boolean() | undefined.
> -type entity()    :: [{atom(), value()}] | {field()}.

These should be fine.

> -type field()      :: value() | value(), field().

Maybe you meant
-type field() :: value() | {value(), field()}.

?

In general, if you want to define tuples of different sizes in -spec,
you use the "|" operator to define as many variants as you like.

Likely I don't understand what you are trying to define.

-- 
Motiejus Jakštys



More information about the erlang-questions mailing list