[erlang-questions] spec declaration for single list parameter with fixed size

Roberto Ostinelli roberto@REDACTED
Sun Jul 3 10:10:16 CEST 2011

dear list,

a very stupid spec declaration question. how can you declare the specs of a
function which has a single list with multiple arguments?

For instance, consider this function:

myfun([One, Two]) ->

these two following declarations do obviously not work:

-spec myfun([One::string(), Two::integer()]) ->
-spec myfun(list(One::string(), Two::integer())) ->

the proper way seems to be:

-spec myfun([string() | integer()]) ->

however i feel this to be very misleading, as the specs do not show the
order nor the fixed length of the parameter list.

is there a better way to do so?

thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110703/273138a1/attachment.htm>

More information about the erlang-questions mailing list