Fields can be described as follows:
foo:'-loop/4-lc$^2/1-3-' ^ ^ ^ ^ ^ ^ ^ 1 2 3 4 5 6 7
- Module name
- Closing function
- Arity of incoming function
- Type fun (
lc = list generator in list comprehension, blc = binary generator in list comprehension, lbc = list generator in binary comprehension, fun = fun) - The index of the function inside the defining function (based on 0)
- Arity of the generated function
- Lambda raising function index in the definition function
Open questions: what is the meaning of the parameters and return values ββof these functions?
Just stumbled upon this answer by Robert Virginia on the same question on the erlang-questions mailing list.
The code that creates these names is distributed among many modules: sys_pre_expand for funs; v3_core for functions created for understanding; and v3_kernel , which adds more when lambda raises functions. The purpose of all this is to create βuniqueβ function names that also give some idea of ββwhy functions were created and why.
There is code in sys_pre_expand.erl for creating function names for funs:
%% new_fun_name(State) -> {FunName,State}. new_fun_name(#expand{func=F,arity=A,fcount=I}=St) -> Name = "-" ++ atom_to_list(F) ++ "/" ++ integer_to_list(A) ++ "-fun-" ++ integer_to_list(I) ++ "-", {list_to_atom(Name),St#expand{fcount=I+1}}.
These names are passed and expanded in the last pass (v3_kernel).
From the v3_core.erl compilers:
%% new_fun_name(Type, State) -> {FunName,State}. new_fun_name(Type, #core{fcount=C}=St) -> {list_to_atom(Type ++ "$^" ++ integer_to_list(C)),St#core{fcount=C+1}}.
Thus, this explains "lc $ ^ 2" (parts 4 and 5) in the example. When viewing the places where it is used, you can display the possible values ββfor part 4: lc , blc and lbc .
In v3_kernel.erl , this is the next phase when these functions are activated by the lambda:
%% new_fun_name(Type, State) -> {FunName,State}. new_fun_name(Type, #kern{func={F,Arity},fcount=C}=St) -> Name = "-" ++ atom_to_list(F) ++ "/" ++ integer_to_list(Arity) ++ "-" ++ Type ++ "-" ++ integer_to_list(C) ++ "-", {list_to_atom(Name),St#kern{fcount=C+1}}.
This means -loop/4- (parts 2 and 3) and -3- (part 7). Part 6 is added to the call to this new_fun_name/2 .
(This post is a wiki community, please add other entries if you know what they mean)