[erlang-questions] Don't understand the error message: call to local/imported function ... is illegal in guard

by by@REDACTED
Mon Dec 24 02:02:05 CET 2018


Only limited expressions are permitted after “if”(guard), and the user defined function does not in the list.
I believe there is a list on Erlang Doc about what is permitted.

By the way, this limitation is for avoiding side effects when evaluating expressions.

Yao

> 在 2018年12月24日,08:26,Donald Steven <t6sn7gt@REDACTED> 写道:
> 
> This code works:
> 
>     AlphaNumericChar = isAlphaNumeric(C),
>     if AlphaNumericChar ->
> 
> but this code (which is functionally identical):
> 
>     if isAlphaNumeric(C) ->
> 
> produces an error message: call to local/imported function isAlphaNumeric/1 is illegal in guard
> 
> Why?
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
> 




More information about the erlang-questions mailing list