[erlang-questions] Sending fun/1 over the network and apply/2 failure

Richard A. O'Keefe ok@REDACTED
Tue Jul 26 04:11:10 CEST 2016



On 25/07/16 11:49 PM, Mikael Pettersson wrote:
> 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.

Given that sending a fun from one node to another can be a sensible
thing to do, this suggests to me that a simple hack might be to
allow someone to specify that a particular fun should be processed
as if it had appeared in the shell, something like
     shell:fun (...) -> ... end
This is something that could probably be whipped up using a parse
transform.

As for me, I internalised the "funs-are-node-specific" idea a long time
ago, so it doesn't matter enough to me for me to do it.





More information about the erlang-questions mailing list