[erlang-questions] about fun vs. functions schisofrenia

Andras Georgy Bekes <>
Fri Jan 11 16:54:03 CET 2008


> A fun defined as fun Module:Function/Arity *will* survive code
> reloading. It has a different internal representation than a fun
> defined as fun Function/Arity.
Hmm, good to know!

This also means that you can have a fun Module:Function/Arity even 
before loading Module, you'll have an error only when you call it.

1> (fun a:b/0).
#Fun<a.b.0>
2> catch (fun a:b/0)().
{'EXIT',{undef,[{a,b,[]},...

In this case there is really no reason to use the old 
{ModuleName,FunctionName} representation.

	Georgy



More information about the erlang-questions mailing list