[erlang-questions] dialyzer and socket without option 'active'
Tobias Lindahl
tobias.lindahl@REDACTED
Tue Nov 6 10:03:00 CET 2007
Ludovic Coquelle wrote:
> Hi,
> First, thanks for dialyzer contributors: dialyzer find caveat as fast as I
> write bug :)
Thanks! Good to hear that dialyzer helps.
> However, it seems to fail to understand this code:
> I open a TCP socket with option [{active, false}, {packet,http}],
> thus I should be able to write something along the line of:
> case gen_tcp:recv(Sock, 0, TO) ->
> {ok, {http_request, M, P, V}} -> ...
> Any -> ...
> end
>
> The code works, but dialyzer complains that 'case' around gen_tcp:recv can
> never match {'error',atom()} | {'ok',binary() | possibly_improper_list()}
> ... looks like dialyzer do not understand the non-documented feature (http
> packet + active false)
>
> Is it a known behaviour?
You're right. Dialyzer do not know about this. For some library
functions that are commonly used, but implemented in a way that dialyzer
(and sometimes we) can't find any good information through analysis, we
hard-code the information in Dialyzer. We then have to rely on the
documentation to find the information, and sometimes there are
undocumented features that we miss.
> Am I doing something wrong?
I cannot answer this. Should this undocumented feature be relied on?
Anybody? If this is the case we will add information about this in
Dialyzer, and someone probably should document the behavior.
Tobias
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list