[erlang-questions] escript exception error, undefined function, why can't use fun in escript script?

Stanislaw Klekot erlang.org@REDACTED
Sun Aug 6 16:45:20 CEST 2017


On Sun, Aug 06, 2017 at 04:22:33PM +0200, Håkan Mattsson wrote:
> Yes, you may have other functions than main/1 in escripts. But the escript
> must be compiled.
> ​​
> Either compiled in run-time
> ​(using -mode(compile)
> ​)​
> ​or pre-compiled ​(using a beam file or archive).

Actually no, you don't need the escript to be compiled to have functions
in there. They work just fine, it's just that they cannot be referenced
with `fun foo/X' syntax if the escript script is not marked as compiled.

-- 
Stanislaw Klekot



More information about the erlang-questions mailing list