In elixir, atoms should start with :
, so why even all literals which starts with upper case are treated as atoms too?
IO.puts is_atom(Foo) # true, why????
IO.puts is_atom(foo) # error undefined function
IO.puts is_atom(:foo) # true
As you can see here, identifiers that start with uppercase letters are treated as atom aliases. In your case, Foo
is an alias of :'Elixir.Foo'
which is an atom.
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