[erlang-questions] guards when using dialyzer

Loïc Hoguin essen@REDACTED
Fri Dec 23 16:32:26 CET 2011


Guards help Dialyzer because Dialyzer can see whether the call will 
succeed more easily than without. For example, if you receive a message 
{msg, Variable}, Dialyzer will think Variable is of type any(). It is 
because you then add a guard that Dialyzer is able to know whether 
Variable is an integer() or something else, and then can pinpoint errors 
more precisely.

Another important thing is that guards let you crash sooner, which is 
generally what you want, crash at the remote ends of the system, not in 
the core.

On 12/20/2011 04:31 PM, Joel Reymont wrote:
> Assuming you are an active user of Dialyzer, do you find yourself using function guards more or less?
>
> I'm wondering if it makes sense to lean heavily on guards when Dialyzer will catch possible issues.
>
> ---
> Hardcore embedded Linux development
> http://www.linkedin.com/in/joelreymont
> Device drivers, firmware and debugging
>
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions


-- 
Loïc Hoguin
Dev:Extend



More information about the erlang-questions mailing list