[erlang-questions] why can't use anonymous function in escript scripts?

Liu Yubao yubao.liu@REDACTED
Tue Feb 3 07:01:12 CET 2009


`escript a.erl` complains:
escript: exception error: undefined function erl_eval:myfun/0

If uncomment the second line, the script works well. It's strange
I can eval "fun io:format/2." in erl shell.

Another related counterintuitive thing is I can't evaluate function
definition in erl shell directly.


myfun() -> 2.

main(_) ->
    io:format("~p~n", [fun myfun/0]).

More information about the erlang-questions mailing list