[erlang-questions] Maps branch and disclaimers
Chris King
colanderman@REDACTED
Thu Oct 31 14:07:53 CET 2013
On Thu, 31 Oct 2013 06:58:18 -0400, Anthony Ramine <n.oxyde@REDACTED>
wrote:
> Write an unary function with 15 (might need more) different clauses
> f(a1) -> ...; ...; f(a15) -> ....
>
> Dialyzer will infer atom() for the argument type because large type
> unions are broadened to make the various type unifications happen in a
> reasonable time, if I understand this correctly.
Yes, Dialyzer necessarily approximates types. And it, by design, fails on
the false negative side of things: it can infer that functions accept
types which actually make them crash.
This has no bearing on the *actual* type signature written by a human to
communicate to other humans. These have meaning outside of Dialyzer.
Unfortunately without a semantic definition of these signatures (which I
sadly can't find!) we're both grasping at straws.
The fact that Dialyzer is *able* (with -Wunderspecs) to warn that a type
is too broad tells me at least that the semantics of type signatures is
ambiguous. Whether this option is a "here's a more sound analysis we're
working on" option, or a "this is for weird people who insist that types
imply success" is unclear.
More information about the erlang-questions
mailing list