[erlang-questions] Dialyzer "function X has no local return"?

Adam Lindberg <>
Thu Aug 30 10:16:56 CEST 2007


Hi all,

What are the implications of adding a local return value? Let's consider the
following code which will raise the warning:

x() ->
    head_of_to_a_loop_which_will_never_return().

The warning:

module.erl:3: Function x/0 has no local return

This can be changed to the function below just to satisfy Dialyzer:

x() ->
    head_of_to_a_loop_which_will_never_return(),
    nobody_will_ever_see_this_atom.

Wouldn't that last atom stay somewhere in case the above function call
actually would return. Because I guess there is no way for the compiler to
know that so it has to keep that last line, thus no tail optimizations are
possible. Am I right? Any thoughts on this?

Cheers!
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070830/e05f9bb0/attachment.html>


More information about the erlang-questions mailing list