Fun with Erlang (was Re: Stand Alone Erlang for Windows. yet again)

Ulf Wiger <>
Sat Mar 17 11:42:09 CET 2001

On Sat, 17 Mar 2001, Vlad Dumitrescu wrote:

>> So, we end up needing another unique ID system.  (Gensym, come home,
>> all is forgiven!)  
>wouldn't references work well here? with today's system dynamic
>atoms à la Gensym are not GCed...

References should work well as long as they don't have to be
persistent. The same goes for pids. You can't dump a pid to disk 
and expect to reuse it later. As for references, they are not really
unique if you keep them long enough (or has that changed in R7?)

I tend to prefer to generate a globally unique ID whenever I need a
reference. The scheme I prefer is 

  ID = {node(), erlang:now()}. 

It's fast, and under most realistic circumstances (even persistently)
unique with very high probability.

Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB

More information about the erlang-questions mailing list