[erlang-questions] clarify: variable as function name

Robert Raschke rrerlang@REDACTED
Mon Dec 10 11:55:53 CET 2007


Lovei Laszlo wrote:

>    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?

Try

g() -> F=fun f/0, F().

The F=f just assigns the atom 'f' to F, and that's not a function.

Robby




More information about the erlang-questions mailing list