About Erlang function, especially the function's identifier -


i have question erlang function. see code in erlang shell:

1> f1 = fun() -> timer:sleep(1000) end. #fun<erl_eval.20.111823515> 2> f2 = fun() -> io:format("hello world~n", []) end. #fun<erl_eval.20.111823515> 

f1 , f2 different, why both having identifier #fun<erl_eval.20.111823515>? , these magic numbers mean?


there paragraph in erts manual, says:

when interpreting data process, helpful know anonymous function objects (funs) given name constructed name of function in created, , number (starting 0) indicating number of fun within function. 

i can not catch meaning of paragraph, can please explain it?

don't read meaning names of anonymous functions. can safely out of name of module in created. can try counting funs in module find 1 wouldn't bother.

that being said, there reason why both of funs have same name. expressions entered in shell not compiled evaluated interpreter in module erl_eval. module has 1 fun interpreting funs of each arity. there 1 fun in erl_eval funs of arity 1, #fun<erl_eval.20.111823515>. hacky, works.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -