[erlang-questions] Function Dependency
Sun Aug 19 23:49:50 CEST 2012
On 19/08/2012, at 11:52 AM, Tyron Zerafa wrote:
> Is there a way in Erlang which can give me a function's dependencies?
It's an open source system.
You have full source code for the compiler and everything.
You can readily get the parsed form of any source file.
You can even (gasp, the technology!) do a web search for
"Erlang cross reference" and discover
"Xref is a cross reference tool that can be used for
finding dependencies between functions, modules, applications
and releases. It does so by analyzing the defined
functions and the function calls."
> Such as dependency_of_fun(A) will result in all functions' names (including modules)
> being used in A?
See the Xref documentation.
> Also, apart from this, can I somehow extract a function clause by knowing its signature only?
Signature? The Erlang equivalent of a signature is a -spec.
Function clauses don't have names, signatures, specifications, or anything else.
It really makes no sense to extract just one clause from a function.
I mean, here is a two-clause function:
app(, L) -> L;
app([H|T], L) -> [H|app(T, L)].
What good does it do you just to have ``app(, L) -> L''?
What are you going to do with half of a function (or less)?
More information about the erlang-questions