Valid characters in atom name

Hi, starting out with Elixir and I have a question about naming atoms.
I’m obviously missing something simple, but this paragraph from the first pages of Programming Elixir makes no sense to me

Atoms are constants that represent something’s name. We write them using a leading colon (:), which can be followed by an atom word or an Elixir operator. An atom word is a sequence of letters, digits, underscores, and at signs (@). It may end with an exclamation point or a question mark. You can also create atoms containing arbitrary characters by enclosing the characters following the colon in double quotes. These are all atoms: ​ ​:fred​ ​:is_binary?​ ​:var​​@​2 ​:<>​ ​:===​ ​:"func/3"​ ​:“long john silver”

:=== does not seem to meet the condition “letters, digits, underscores and at signs”, and does not use double quotes. Why is it a valid atom?

Thanks!

2 Likes

=== is an elixir operator, thus :=== is a valid atom. :slight_smile:

3 Likes

Thanks! Read it over again and of course that’s right. This led me to the reference page on operators (https://hexdocs.pm/elixir/master/operators.html) which I hadn’t seen yet.

Does anyone know if there an obvious reason for having this kind of construction? I can’t understand the logic behind having it. Do you use :<> etc. in your code?

1 Like

Since functions (and operators are functions) are represented as atoms in the AST, having all valid operators be valid atoms makes it easier to work with macros.

3 Likes