[erlang-questions] Sending fun/1 over the network and apply/2 failure
Sid Muller
sid5@REDACTED
Mon Jul 25 14:17:00 CEST 2016
> Sent: Monday, July 25, 2016 at 6:49 AM
> From: "Mikael Pettersson" <mikpelinux@REDACTED>
> To: "Sid Muller" <sid5@REDACTED>
> Cc: erlang-questions@REDACTED
> Subject: Re: [erlang-questions] Sending fun/1 over the network and apply/2 failure
> A closure only contains a reference to its code, not a copy of the code
> itself. Taking a closure created in module M, passing it to another
> Erlang node and applying it there, requires that the module M is present
> there as well. If it isn't, or if the modules differ too much, you get
> a badfun exception.
>
> The code part of a closure created in the shell refers to a module in
> the Erlang interpreter (erl_eval or something like that) with the actual
> expression being a plain term in the closed over free variables (which
> the module can interpret). That's why the shell's closures work in some
> cases where closures from beam files don't.
Ahhh, OK that makes sense.
Thank you
More information about the erlang-questions
mailing list