if you cant read the whole answer
Update
context: Answer is "three"
EDIT: Sorry The answer is misleading,
here is the right answer:
As the F is just defined but the function is not evaluated,
since we are making a fully qualified call before evaluating F;
the new code will be loaded and the value will be "three"
So, i posted the question in erlang mailing list, i got the reply with this answer
Funs are always bound to the code they are initially loaded from. Only name look-ups are affected by code loading AFAICT.
This has been a source of exceptions in our previous development, because the first time you load new code, F is still valid, but the second time you load new code, the old code is purged and F is now invalid. Any call to it will generate an exception.
We ended up wrapping our needs for lambdas in a module with state instead. Not the most elegant, but allows us to get "dynamic lambdas." If all you need in the fun is module:function, you can use a tuple for that instead of a fun.
Sincerely,
jw