calling a local function with an atom stored in a variable.

Mariano Guerra <>
Fri Aug 20 22:21:55 CEST 2010


hi,

 a question appeared in the spanish mailing list and we couldn't find
the answer.

from the erlang reference:

http://www.erlang.org/doc/reference_manual/expressions.html#id2273323

"""
ExprF(Expr1,...,ExprN)
ExprM:ExprF(Expr1,...,ExprN)

In the first form of function calls, ExprM:ExprF(Expr1,...,ExprN),
each of ExprM and ExprF must be an atom or an expression that
evaluates to an atom. The function is said to be called by using the
fully qualified function name. This is often referred to as a remote
or external function call. Example:

lists:keysearch(Name, 1, List)

In the second form of function calls, ExprF(Expr1,...,ExprN), ExprF
must be an atom or evaluate to a fun.
"""

the last line " ExprF must be an atom or evaluate to a fun", why can't
ExprF evaluate to an atom? why ExprF = foo, ExprF() doesn't work but
?MODULE:ExprF() does?


More information about the erlang-questions mailing list