我有一个关于 Erlang 函数的问题。查看 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不同,但为什么它们都有标识符#Fun<erl_eval.20.111823515>
?这些神奇的数字是什么意思?
ERTS Manual中有一段,说:
When interpreting the data for a process, it is helpful to know that anonymous
function objects (funs) are given a name constructed from the name of the
function in which they are created, and a number (starting with 0) indicating
the number of that fun within that function.
我也无法理解这一段的意思,你能解释一下吗?