Funs behaving differently after native compilation

Joel Reymont joelr1@REDACTED
Thu Jan 12 17:03:12 CET 2006

I could certainly change things to

     Closer = fun(Sock) -> gen_udp:close(Sock) end,
     monitor(self(), Sock, Closer),

for this particular case but I'm also passing the name of the module  
from the command like to invoke the script function in it.

I don't see how I can construct a real fun from an atom that is the  
module name.

On Jan 12, 2006, at 4:00 PM, Joel Reymont wrote:

> Folks,
> My funs seem to behave differently when the beams are compiled to  
> native code.
> Is there an explanation to this? I am passing indeed passing funs  
> as {M, F} and then calling them as per the code below.
> Why does it work when the code is byte-compiled and how do I work  
> around these errors?
> monitor(self(), Sock, {gen_udp, close})
> monitor(Sock, Closer) ->
>     receive
> 	{'DOWN', _, process, _, _} ->
> 	    Closer(Sock);
> 	Any ->
> 	    io:format("Monitor: Unknown:~n~p~n", [Any]),
> 	    monitor(sock, Closer)
>     end.


More information about the erlang-questions mailing list