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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With