[erlang-bugs] erl rejects FQN that begin with a digit
Wed Oct 20 14:37:45 CEST 2010
On Wed, Oct 20, 2010 at 14:13, Patrick Baggett
> -- snip --
> 2.3 Atom
> An atom is a literal, a constant with name. An atom should 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
> -- snip --
> contains a @, so one would expect if this was a single atom, that
> single quotes would be required, but they aren't. Erlang just magically
> knows, that is, unless you start it with a digit, because when it is broken
> into multiple atoms (I guess?) it fails the test of starting with a lower
> case character.
It's not the @ that separates the name in multiple atoms, but the
dots. It's an artifact of the still experimental package feature that
you can chain atoms together with dots, in the old times one had to
use quotes for host names.
> But if it starts with a digit, then it needs quotes, /around the whole
> thing/, meaning it isn't a sequence of , but just 'atom'
> I would have expected to see host1@'8fun'.net, which makes '8fun' an atom,
> rather than the whole thing.
No, quotes around the misbehaving atom work fine:
* 1: syntax error before: 2
More information about the erlang-bugs