atom. atom 2> next_atom. next_atom 3> atom@erlang. atom@erlang 4> 'atom in ...">

Erlang atoms and ".."

This is the output of the erlang shell:

1> atom.
atom
2> next_atom.
next_atom
3> atom@erlang.
atom@erlang
4> 'atom in single quotes'.
'atom in single quotes'
5> atom = 'atom'.
atom
6> a.tom.
'a.tom'
7> a..tom.
* 1: syntax error before: '..'

When there is only one dot in the atom (line 6) ., I get no errors. However, when there is .., I get a syntax error. Does ..Erlang make much sense, or why am I getting an error when it .works fine?

+5
source share
1 answer

Points are not allowed as such in atoms, but a point between two atoms:, 'foo'.'bar'is a compile-time operator that combines atoms in 'foo.bar'.

This is an extension that was made to support (still officially supported) a Java-like package system. That is why it is not documented.

+15
source

All Articles