5

The Erlang official user's guide (http://erlang.org/doc/reference_manual/data_types.html#id67942) says:

An atom is to be enclosed in single quotes (') if it does not begin with a lower-case letter or if it contains other characters than alphanumeric characters, underscore (_), or @.

Why Erlang allows an atom to include bare @ signs? Does it have a practical usage, or any historical meaning?

2240
  • 1,547
  • 2
  • 12
  • 30
Tsutomu
  • 4,848
  • 1
  • 46
  • 68

1 Answers1

8

Does it have a practical usage

Yes it does. Node names in Erlang are represented as atoms and they contain an @ separating the name and host. Allowing @ in atoms without single quotes makes it convenient to type them (unless they contain other special characters like . or -).

$ erl
1> foo@bar.
foo@bar
Dogbert
  • 212,659
  • 41
  • 396
  • 397