[erlang-questions] Frames proposal
Sun Dec 30 16:40:18 CET 2012
> From: Max Lapshin <>
>What is the idea to make atoms collectable?
>They are designed as a limited number of domain specific words. You cannot deal with endless amount of domain language, it is always finite. So atoms are also finite.
Hi Max, I'm not sure what you mean? As far as I know, atoms can be used for many purposes (and have been, in Erlang as well as its ancestors Prolog and Lisp). However, due to the implementation limitations in Erlang/OTP some of these uses are considered bad practice, particularly for long-running servers.
For example, Yaws used to represent HTTP header names as atoms, which is nice since comparison is fast and O(1) and atoms are represented once, unlike binaries, which saves memory. This approach was replaced by using binaries for header names once it was realized incoming HTTP requests could cause ERTS to run out of atoms, by accident or on purpose. It would have been simple, easy, fast and compact to use atoms, except that atoms leaked due to not having a GC.
With that said, it is of course possible to work around this. Use binaries, use list_to_existing_atom/1, use coding standards, etc.
More information about the erlang-questions