The proper syntax should be:<br><br> g() -> F=fun f/0, F().<br><br>It is because if you simply put 'f' there, it is considered an atom, not a function. Hence the 'badfun'.<br><br>Cheers, Anthony<br><br>
<div class="gmail_quote">On Dec 10, 2007 9:24 PM, Lovei Laszlo <<a href="mailto:lovei@elte.hu">lovei@elte.hu</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all!<br><br>A quote from the reference manual:<br><a href="http://www.erlang.org/doc/reference_manual/expressions.html#6.6" target="_blank">http://www.erlang.org/doc/reference_manual/expressions.html#6.6</a><br><br>
6.6 Function Calls<br><br> ExprF(Expr1,...,ExprN)<br> ExprM:ExprF(Expr1,...,ExprN)<br><br> ExprM should evaluate to a module name and ExprF to a function name<br> or a fun.<br> [...]<br> The module name can be omitted, if ExprF evaluates to the name of a
<br> local function, an imported function, or an auto-imported BIF.<br><br>This means that the following code is valid (F evaluates to a local<br>function name):<br><br> f() -> ok.<br> g() -> F=f, F().<br><br>
In practice, this aborts with the reason badfun. The question is, which<br>one is considered good: the manual, or the implementation?<br><br><br>Thanks!<br>Laszlo<br>_______________________________________________<br>erlang-questions mailing list
<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions
</a><br></blockquote></div><br><br clear="all"><br>-- <br>/*--*/<br>Experience is simply the name we give our mistakes.<br>---- Oscar Wilde