[erlang-questions] how: to serialize a function?

Matthew Dempsky matthew@REDACTED
Mon Feb 25 22:10:00 CET 2008


On 2/25/08, Tim Fletcher <twoggle@REDACTED> wrote:
>  Next, given that I can get a string representation of the function like so:
>
>     > erlang:fun_to_list(F).
>     "#Fun<erl_eval.6.49591080>"
>
>  My second question is: what function do I use to turn that string back
>  into (a proper "reference" to) the function F?

The string representation of a fun is insufficient to reconstruct the
fun.  It lacks important things like bound variables.  You need to use
term_to_binary and binary_to_term for that.



More information about the erlang-questions mailing list