[erlang-questions] Execute module code from stored anonymous function

Dmytro Lytovchenko <>
Sun Sep 11 09:08:27 CEST 2016


In your case the pointer to function is stored internally and it goes
extinct when module is gone.
If you make it calculate function at runtime by, say, calling
apply(mprocess, process_template, [test]), then it should work.

sön 11 sep. 2016 kl 08:57 skrev Nuku Ameyibor <>:

> Dear List ,
>
> i run into an issue where i was storing an anonymous function in mnesia
> to be executed later .
> *F=fun(test) ->mprocess:process_template(test)end.*
>
>
> however  as soon as i make some changes to the mprocess module  and
> upgrade the module i get a *** exception error: bad function* error when
> i retrieve the fun and try to execute which i assume is because of the
> difference in the module versions .
> Is there a way of making the stored fun execute the code and not have
> version conflicts .
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160911/58afbda1/attachment.html>


More information about the erlang-questions mailing list