[erlang-questions] calling a local function with an atom stored in a variable.

Mazen Harake mazen.harake@REDACTED
Fri Aug 20 21:35:36 CEST 2010


  On 20/08/2010 23:21, Mariano Guerra wrote:
> 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?
Try:

-module(m).
-compile(export_all).
foo() -> (bar()):(baz())().
bar() -> m.
baz() -> biz.
biz() -> io:format("Hello World").

Should work. Hope it sheds some light.




More information about the erlang-questions mailing list