On Fri, May 10, 2019 at 12:00 PM Monk Boy <
[hidden email]> wrote:
>
> Hi
>
> When compile the code , I got a message:
>
> ```
> src/http_qmonitor.erl:58: Warning: the call to node/0 has no effect
> ```
>
> the code is
>
> ```
> N = length([node()|nodes()]),
> ```
>
Internally, the compiler does a series rewrites. First we have:
V1 = node(),
V2 = nodes(),
N = length([V1|V2])
Then the compiler rewrites the code like so:
V1 = node(),
V2 = nodes(),
N = length(V2) + 1
since the length of the list does not depend on the value value of V1.
It then notices that V1 is no longer used, issues a warning and
rewrites the code like so:
V2 = nodes(),
N = length(V2) + 1
/Björn
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions