[erlang-questions] Anonymous functions or callback module - Performance

Richard Carlsson carlsson.richard@REDACTED
Wed Nov 28 22:03:09 CET 2012


On 2012-11-28 21:36, Daniel Goertzen wrote:
> This code...
>
> FList = [F1 = fun callback_module:fun_1/1 end... F1 = fun
> callback_module:fun_3/1].
>
> ... has led me to another question for the mailing list:  Will these
> funs automatically use a new version of loaded module or are they
> permanently fixed to the old version?
>
> Dan.

Yes, those symbolic funs using the "fun foo:bar/1" notation always use 
the latest version of the module when you apply them. They are not tied 
to any particular module version. (However, funs that use the syntax 
"fun foo/1", are tied to that version of the module, just as if they had 
been written "fun (X) -> foo(X) end", since the function foo(X) isn't 
necessarily exported.)

     /Richard




More information about the erlang-questions mailing list