How do I create a specific ref() ?

Thijs Terlouw <>
Thu Jul 30 10:40:51 CEST 2009


How do I create a new ref() for a specific value (based on an old #Ref)?

I know I can use "erlang:make_ref() -> ref()" to get a new almost unique
Reference.
I can also use "erlang:ref_to_list(Ref) -> string()" to serialize a Ref to a
String.
It seems there is no "list_to_ref(String) -> ref()" function though, what's
the reason for this?

My use case:
I am writing an async port program which is called from a gen_server() and I
would like to prevent storing the a mapping {Seq -> From} in ETS. If I could
just pass the serialized Pid + serialized Ref to the port program, my
problems would be solved, because the port program could return the Pid +
Ref and I deserialize them again.

Cheers,
Thijs


More information about the erlang-questions mailing list