[erlang-questions] Erlang way for process-as-library?

Matthias Lang matthias@REDACTED
Thu Apr 26 19:42:38 CEST 2007

ok writes:

 > A client of the behaviour has to export those callback
 > functions to the behaviour.  
 >  Passing funs is no real remedy, because you want these 
 > functions to be replaced when the module is reloaded.

Does the following example affect your conclusion?

   Eshell V5.5.2  (abort with ^G)
   1> c(funs).
   2> F = funs:return_fun().
   3> F().
   version 1
   4> c(funs).               % I edited the source before recompiling
   5> F().    
   version 2
   6> c(funs).
   7> F().    
   version 3




return_fun() ->
	fun f/0.

f() ->
	io:fwrite("version 1\n").

More information about the erlang-questions mailing list