[erlang-questions] Function Dependency

Tyron Zerafa tyron.zerafa@REDACTED
Tue Aug 21 08:23:17 CEST 2012


Hey,
    Thanks for your answers, I tried using xref and it is working
perfectly, I am able to get both the local and remote functions which I am
calling from a specific function.

I need to extract the function body for the following reasons. I need to
transfer only the code that a function makes use of between nodes, nothing
more. Xref is giving me the signature of all those functions that I need.
Now, I want to use these signatures to extract the remaining body of the
functions.

Another short question, is there any way in which I can differentiate
whether a function comes from an Erlang release or not? Thus, if for
example I ask is_native(io_lib,format,2) - > true,
otherwise is_native(MyModule, MyFunction,0) -> false. I do not need to
transfer functions which are native to Erlang and which can be found on any
Erlang node.

Thanks again for your help

On Tue, Aug 21, 2012 at 12:58 AM, Richard O'Keefe <ok@REDACTED> wrote:

>
> On 21/08/2012, at 9:48 AM, Justin Calleja wrote:
> >
> > Here's one instance that comes to mind with regards to wanting part of a
> function definition (i.e. just some of it's clauses):
> > When implementing a gen_server you handle synchronous requests using
> handle_call/3. You might just want the implementation of handle_call/3
> which deals with certain messages.
>
> Yes, but that part
>  - might be more than one clause
>  - which need not be contiguous in the function
>  - and some or all of them might be shared with the handling
>    of other messages.
>
> It is possible to deliberately construct a function as a
> collection of clauses with small non-overlapping heads that
> simply redirect to other functions, so that it would make
> sense to extract part of _that_ function, and you would
> do so *not* by extracting the clause but by simply picking
> up the entire function that it delegates to.
>
> That doesn't mean it makes sense to extract part of a
> function that wasn't written to be treated that way.
>
>
>


-- 
Best Regards,
Tyron Zerafa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120821/b6981597/attachment.htm>


More information about the erlang-questions mailing list