[erlang-questions] Why should you ever use atoms?

Thomas Gebert <>
Sat Oct 10 17:46:20 CEST 2015


I know this is probably kind of a newbie question, but I figured this 
would be the place to ask it: if atoms aren't garbage collected, why 
should I use them? For example, it's a common pattern to have something 
like:

     myFunction({user, "tombert","eats pizza"}) -> %% do something

When I could easily do something like:

     myFunction({"user", "tombert", "eats pizza"}) -> %% do something

----

I could be way off here, but wouldn't the string be garbage collected?  
Is there a benefit to atoms that I'm missing?

-Tombert.


More information about the erlang-questions mailing list