[erlang-questions] Introspecting the atom table

Michael McDaniel <>
Thu Dec 21 05:23:39 CET 2006


 Aha, thank you for the question and the answer.  I have a few
 places in my code to change the try/catch I've been using.  I
 do not remember where/when I started thinking new atoms would
 be created and changed my code from simple list_to_atom funs.

~M
(had a bit of email problem, pasted answer on wrong msg before!)


On Thu, Dec 21, 2006 at 02:37:33AM +0100, Robert Virding wrote:
> It checks if the atom exists, you can only have 1 copy of an atom! 
> That's why testing them equality is so fast.
> 
> Robert
> 
> Yariv Sadan wrote:
> > Do repeated calls to list_to_atom(Str) with the same Str value
> > actually create new atoms, or does list_to_atom() check if the atom
> > already exists? (I thought it was the latter)
> > 
> > Yariv
> > 
> > 
> >> My understanding is that "an atom is forever".  In long running
> >> code I don't want to keep creating new atoms if I already have
> >> one.  The above I use where I have sporadic communication between
> >> remote servers that could come online or offline.
> >>
> >> This was one example where I might not want to keep creating new
> >> atoms so use the try/catch idiom.
> >>
> >>~M
> >>_______________________________________________
> >>erlang-questions mailing list
> >>
> >>http://www.erlang.org/mailman/listinfo/erlang-questions
> >>
> > 
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> > 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 
> !DSPAM:52,4589e57e18341971831101!
> 
> 

-- 
Michael McDaniel
Portland, Oregon, USA
http://autosys.us
+1 503 283 5284



More information about the erlang-questions mailing list