[erlang-questions] escript vs. function
Fernando Benavides
fernando.benavides@REDACTED
Thu Nov 24 17:15:04 CET 2011
That did the trick. Thanks :)
*Fernando Benavides <http://google.com/profiles/greenmellon>*
On Thu, Nov 24, 2011 at 1:07 PM, Håkan Mattsson <hm@REDACTED> wrote:
> Try with adding this compiler directive:
>
> -mode(compile).
>
> /Håkan
>
> On Thu, Nov 24, 2011 at 4:48 PM, Fernando Benavides
> <fernando.benavides@REDACTED> wrote:
> > Hi all,
> >
> > Today I've run into a new (to me, at least :P) tricky situation in
> escript.
> > Check the following script:
> >>
> >> #!/usr/bin/env escript
> >>
> >> add1(X) -> X + 1.
> >> main(_Args) -> lists:map(fun add1/1, lists:seq(1,10)).
> >
> > If you try to run it, it fails with the following message:
> >
> >> escript: exception error: undefined function erl_eval:add1/1
> >
> > If you try this one instead...
> >
> >> #!/usr/bin/env escript
> >>
> >> add1(X) -> X + 1.
> >> main(_Args) -> lists:map(fun ?MODULE:add1/1, lists:seq(1,10)).
> >
> > Then you get...
> >
> >> priv/test:3: Warning: function add1/1 is unused
> >> escript: exception error: undefined function
> >> test__escript__1322__149559__518984:add1/1
> >> in function lists:map/2
> >> in call from erl_eval:local_func/5
> >> in call from escript:interpret/4
> >> in call from escript:start/1
> >> in call from init:start_it/1
> >> in call from init:start_em/1
> >
> > It's not too complicated to work around, but I thought I should share it.
> > Cheers
> >
> > Fernando Benavides
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111124/bdcd2fb0/attachment.htm>
More information about the erlang-questions
mailing list