[erlang-questions] Tricky Dialyzer type
Raimo Niskanen
raimo+erlang-questions@REDACTED
Mon Jul 20 18:56:23 CEST 2015
On Mon, Jul 20, 2015 at 03:19:02PM +0200, Jesper Louis Andersen wrote:
> On Mon, Jul 20, 2015 at 11:49 AM, Raimo Niskanen <
> raimo+erlang-questions@REDACTED> wrote:
>
> > That's a pity. For me it is just about two different kinds of wrappers.
> > Obviously I am not a type expert.
> >
>
> The reason it is somewhat uncommon to want a list in a programming language
> with type systems is that you can't get it to compile if the type check
> fails. So in such a language, you would have been forced into the product
> type with a tuple {uint8(), [ty()]} as the only way to represent this. The
> wrong program would never have existed. Hence it would not be a problem.
>
> Digging further, you eventually hit granite in the sense that you do need a
> heterogenous list type. When that happens you are either out of luck, or
> the type system is expressive enough to let you model it.
>
> It is, generally, hard to graft a type system unto old code. You may have
> to fall back to say that your data is [any()]. It is unsatisfactory, but at
> least it is correct. I think that if you ask the 'typer' program, you get
> the most specific type in the type lattice which dialyzer can figure out
> from looking at the code base. If you use this type, you are at least not
> incorrect, and you are at the limit of what the dialyzer understands,
> currently.
Ok. Thank you for your time. I now know a bit more than before.
Best Regards
/ Raimo
>
>
>
>
> --
> J.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions
mailing list