[erlang-questions] -spec tuple variable size

Dmitry Kolesnikov dmkolesnikov@REDACTED
Thu Nov 29 18:25:06 CET 2012


Thanks! 
I'll continue with a -spec entity() :: tuple() and handle type validation at run-time

- Dmitry


On Nov 29, 2012, at 6:58 PM, Motiejus Jakštys <desired.mta@REDACTED> wrote:

> On Thu, Nov 29, 2012 at 4:46 PM, Dmitry Kolesnikov
> <dmkolesnikov@REDACTED> wrote:
>> Hello,
>> 
>> I do offer an api to store a tuple. The storage do not concern the tuple cardinality, in similar fashion like ets/dets does. One of my current limitation is that tuple elements MUST be a particular data type. I simply want to validate that client writes tuples with supported data types. I am also fine with generic tuple() data type but it is less error prone.
>> 
> 
> If you really need that, you could write a parse_transform, which
> would create 4096 reincarnations of correct tuples. However, I
> think[1] it will still be reduced to tuple() by dialyzer during
> checking time (please correct me if not).
> 
> [1]: http://erlang.org/pipermail/erlang-questions/2012-August/068855.html
> Unfortunately, patch for dialyzer to replace SET_LIMIT to a run-time
> argument, in this case 4096, still did not reach the top of my todo
> list.
> 
> -- 
> Motiejus Jakštys




More information about the erlang-questions mailing list