[erlang-questions] How do I create a specific ref() ?

Bengt Kleberg <>
Thu Jul 30 10:57:58 CEST 2009


Greetings,

Would it be possible for you to always use the serialised ref() in your
program, instead of the original, unserialised, ref()? Then you would
never have to deserialize it.


bengt

On Thu, 2009-07-30 at 16:40 +0800, Thijs Terlouw wrote:
> 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