new syntax - a provocation
Richard A. O'Keefe
Thu Sep 25 08:38:43 CEST 2003
Joe Armstrong <joe@REDACTED> discussed two ways of implementing
atoms without a (permanent) atom table.
I don't understand what Mod and Index are.
The question is "what do we want a global atom table _for_?"
Mainly, so that atom equal/not-equal testing can be O(1).
Now, suppose an atom is a tagged pointer to a
block. You only compare the data if the hash and size are the same.
Most Erlang atoms are fairly short, so while this would be slower than
whatever it is now, it wouldn't get _that_ much slower.
The hash value would be used for indexing in clause/case selection.
Or suppose that each module has a fixed set of atoms, known at
compile time, plus each process has an atom table. Atoms which the
process creates dynamically can be looked up in the process atom table.
Atoms that are sent to another process get looked up in the other
process's atom table when they arrive. (The aim here is not to ensure
uniqueness, but to keep the amount of space used for atom names bounded.)
I'm sure that there are lots of implementation alternatives to explore.
More information about the erlang-questions