Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Erlang allows an atom to include bare @ signs? Does it have a practical usage?

Tags:

erlang

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?

like image 305
Tsutomu Avatar asked Nov 05 '16 06:11

Tsutomu


1 Answers

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
like image 131
Dogbert Avatar answered Oct 12 '22 23:10

Dogbert