[erlang-bugs] Syntax of fun expressions

Björn Gustavsson <>
Sun Mar 7 12:31:54 CET 2010

2010/3/6 Kostis Sagonas <>:

> A tidier user complained that tidier's suggestion to transform
>        spawn_link(?MODULE, rec, [])
> to
>        spawn_link(fun (?MODULE):rec/0)
> resulted in a syntax error.  Arguably, (?MODULE) expresses the grouping of ?
> with MODULE in ?MODULE:rec/0 better than without parentheses.
> Moreover, apparently the parser insists that M and F are *statically* atoms
> (and A integer) so one cannot write:
>        M = lists,
>        F = fun M:last/1

There is an EEP that propose that variables should be allowed
in external funs:


As far as I can remember, we have approved that EEP. We have
not implemented it because of lack of time (not that it is very
difficult, just that other things had higher priority).

To also allow arbitrary expressions would be fine for me,
unless they would cause some ambiguity or other
problem in erl_parse.

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-bugs mailing list