[erlang-questions] erl_parse:abstract on a fun

Robert Virding rvirding@REDACTED
Sat Feb 7 02:56:13 CET 2009


2009/1/28 David Sveningsson <ext@REDACTED>

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi, I recently ran into an issue where I am calling erl_parse:abstract
> on a fun which fails with function_clause. What I need is to convert any
> term to abstract form and in this case it was a stacktrace containing a
> fun.


The basic problem is that there is no abstract form for a fun, not at least
for a fun term. In the same way there is no abstract form for a function.
It's the same with pids and refs.


> Now I see two alternatives for solving this:
>
> 1) Try to convert the fun to abstract form for and wrap it somehow.
> 2) Replace the fun with erlang:fun_to_list/1 or similar, and live having
> the "string representation".
>
> Either way seems a bit difficult as it would involve traversing an
> unknown term and replacing funs as needed.
>
> Is this possible to do? Or is there a simpler way?


What are you trying to do?

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090207/95670655/attachment.htm>


More information about the erlang-questions mailing list