[erlang-bugs] erl rejects FQN that begin with a digit

Patrick Baggett <>
Wed Oct 20 14:13:23 CEST 2010


On Wed, Oct 20, 2010 at 7:03 AM, Patrick Baggett
<>wrote:

> That seems like an odd deficiency of the parser, or maybe just an artifact
> of the language. I guess there isn't any support for treating  as
> a single unit since it is trying to convert everything into atoms rather
> than leaving it a string. Well, I won't say it is intuitive, but it does
> work. Thanks
>
> Patrick
>
>
Let me qualify that, for the record.
>From http://www.erlang.org/doc/reference_manual/data_types.html

-- 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.

 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.

...which is why I think it isn't particularly intuitive.

Patrick


More information about the erlang-bugs mailing list