Macro expansion is confused by anonymous functions
John Hughes
john.hughes@REDACTED
Wed Jun 24 18:27:11 CEST 2009
The following module is wrongly rejected by the macro processor:
-module(bug).
-define(ID(X),X).
f() ->
?ID(begin fun() -> ok end, ok end).
The error message is "argument mismatch for macro ''ID''". It looks as though the end that terminates the fun is matched against the begin at the start of the macro argument. Enclosing the fun in brackets makes the macro processor accept it. Omitting the ", ok" also makes the macro processor accept it, somewhat to my surprise!
John
More information about the erlang-bugs
mailing list