Missing features in Erlang type system and several additional question related to it

Sergii Boiko <>
Tue Aug 31 16:41:27 CEST 2010

> Your arguments are very weak, but you probably know that already. In
> Erlang it's tuples and not lists which are supposed to be used for
> collections of items of known number.

You've missed the point. I don't argue with anything. I've pointed
out in the leak of type system. There is a structure in Erlang, which
correct. You can create it, you can use it, but can't describe it

And at the same time there is much less 'idiomatic' and 'correct'
like 'maybe_improper_list' and 'nonempty_maybe_improper_list' which
you can.

> If json or mochiwebjson2 or
> whatever has limitations, then the answer to what you are trying to do
> is most probably a call to tuple_to_list/1 away...

It's not a question of library. It's a question of integration with
languages. In Ruby, JavaScript and many others there are no tuples.
instead of tuple arrays is used. So we have tuple=>array=>list
as result. And i don't wont to pay performance penalty with call to
tuple_to_list when i can avoid it.

> If you want to stick with lists, the closest you currently can get with
> the current type language is to use the following definition:
>   -type packet() :: [integer() | packet_encoding() | binary()].

I did it like this.

> Which version of dialyzer are you using, by the way?  Dialyzer supports
> parameterized modules since Erlang/OTP R13B04.

Thanks for the tip. I'm using R13B03. Will check it out on R13B04.

More information about the erlang-questions mailing list