[erlang-questions] clarify: variable as function name
Lovei Laszlo
lovei@REDACTED
Mon Dec 10 11:24:50 CET 2007
Hi all!
A quote from the reference manual:
http://www.erlang.org/doc/reference_manual/expressions.html#6.6
6.6 Function Calls
ExprF(Expr1,...,ExprN)
ExprM:ExprF(Expr1,...,ExprN)
ExprM should evaluate to a module name and ExprF to a function name
or a fun.
[...]
The module name can be omitted, if ExprF evaluates to the name of a
local function, an imported function, or an auto-imported BIF.
This means that the following code is valid (F evaluates to a local
function name):
f() -> ok.
g() -> F=f, F().
In practice, this aborts with the reason badfun. The question is, which
one is considered good: the manual, or the implementation?
Thanks!
Laszlo
More information about the erlang-questions
mailing list