[erlang-questions] Sending funs between nodes

Kirill Zaborski qrilka@REDACTED
Thu Aug 30 11:27:43 CEST 2007


But I do not see the reason of it.
Any hints?
Are funs implemented somewhat like "anonymous" functions (so
internally they are normal functions but they do not have "normal"
name)?

Regards,
Kirill.

On 8/30/07, Bengt Kleberg <bengt.kleberg@REDACTED> wrote:
Greetings,
>
>
> yes, the fun needs the code.
> yes, you need the beam files on both nodes.
>
>
> bengt
>
> Those were the days...
>     EPO guidelines 1978: \\\"If the contribution to the known art resides
>     solely in a computer program then the subject matter is not
>     patentable in whatever manner it may be presented in the claims.\\\"
>
>
> On 2007-08-29 21:28, Kirill Zaborski wrote:
> > I was trying to do the following:
> > 1) a module on node X -
> > -------------------
> > -module(test1).
> > -export([go/0]).
> >
> > go() ->
> > P = spawn(fun() -> receive X -> X() end end),
> > register(rrr, P).
> > -------------------
> > 2) a module on node Y -
> > -------------------
> > -module(test2).
> > -export([go/0]).
> >
> > go() ->
> > {rrr, x@REDACTED}!fun() -> io:format(\\\"bar\\\",[]) end.
> > -------------------
> >
> > LOKI is my hostname :)
> >
> > So If I run test1:go() and then test2:go() on other node I get
> >
> > =ERROR REPORT==== 29-Aug-2007::22:34:29 ===
> > Error in process <0.35.0> on node \\\'y@REDACTED\\\' with exit value:
> > {undef,[{shell_defau
> > lt,fun_to_list,[#Fun<erl_eval.20.62269157>]},{erl_eval,do_apply,5},{shell,exprs,
> > 6},{shell,eval_loop,3}]}
> >
> > ** exited: {undef,[{shell_default,fun_to_list,[#Fun<erl_eval.20.62269157>]},
> >                    {erl_eval,do_apply,5},
> >                    {shell,exprs,6},
> >                    {shell,eval_loop,3}]} **
> >
> > It looks like fun needs code of the module where it was defined. Why is
> > it so?
> > is there any way around this issue? Or I need the same beams on all the
> > nodes?
> >
> >
> > Best regards,
> > Kirill Zaborski.
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list