<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>No this do not work!</div><div>here is my snippet</div><div><br></div><div>-- CLIP --</div><div>-type entity()    :: tuple(integer()).</div><div><br></div><div>-spec create(atom(), entity()) -> ok.</div><div>create(abc, {1, 1})</div><div><br></div><div>test.erl:237: The call test:create('abc',{1,1}) will never return since the success typing is (any(),{integer()}) -> 'ok'</div><div><br></div><div>-- CLIP --</div><div><br></div><div>- Dmitry</div><div><br></div><div><br><div><div>On Nov 29, 2012, at 6:05 AM, Slava Yurin <<a href="mailto:YurinVV@yandex.ru">YurinVV@yandex.ru</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi, Dmitry.</div><div> </div><div>May be "tuple(Type)" help you?</div><div> </div><div>-type my_tuple() :: tuple(integer()). % {1}, {1,1}, {1, ...} </div><div> </div><div>29.11.2012, 05:10, "Dmitry Kolesnikov" <<a href="mailto:dmkolesnikov@gmail.com">dmkolesnikov@gmail.com</a>>:</div><blockquote type="cite"><p>Hello,<br><br>Thanks for response!<br>Let me explain better what I am trying to achieve.<br>"The shorthand [T,...] stands for the set of non-empty proper lists whose elements are of type T." <br>I am looking for similar definition but for tuples.<br><br>My application serialises tuples into disk. The size of tuple is unbound but tuple elements a fixed to string, binary, number, boolean or undefined. I cannot use " "|" operator to define as many variants as you like" because number of variants is unlimited. Well practically, I do have a hard limit of 4096 elements per tuple but I am lazy to type in 4096 variants :-) <br><br>- Dmitry<br><br>On Nov 28, 2012, at 11:50 PM, Motiejus Jakštys <<a href="mailto:desired.mta@gmail.com">desired.mta@gmail.com</a>> wrote:</p><blockquote> On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov<br> <<a href="mailto:dmkolesnikov@gmail.com">dmkolesnikov@gmail.com</a>> wrote:<br><blockquote> but compiler fails syntax error before: ','<br><br> -- CLIP --<br> -type value()     :: string() | binary() | number() | boolean() | undefined.<br> -type entity()    :: [{atom(), value()}] | {field()}.</blockquote> These should be fine.<br><blockquote> -type field()      :: value() | value(), field().</blockquote> Maybe you meant<br> -type field() :: value() | {value(), field()}.<br><br> ?<br><br> In general, if you want to define tuples of different sizes in -spec,<br> you use the "|" operator to define as many variants as you like.<br><br> Likely I don't understand what you are trying to define.<br><br> -- <br> Motiejus Jakštys</blockquote><p>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a></p></blockquote></blockquote></div><br></div></body></html>