[erlang-bugs] erl rejects FQN that begin with a digit
Raimo Niskanen
<
>
Thu Oct 21 11:27:59 CEST 2010
On Wed, Oct 20, 2010 at 02:37:45PM +0200, Vlad Dumitrescu wrote:
> On Wed, Oct 20, 2010 at 14:13, Patrick Baggett
> <
> wrote:
> > -- 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.
Long host names that is.
has always been interpreted as an atom.
That was a peculiar side effect of the package system. The traditional
answer is: node names with fully qualified host names has to be quoted
in whole e.g '
'.
>
> > 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>
>
> 2>
>
> 4>
> * 1: syntax error before: 2
> 4>
'2y'.
> '
'
>
> regards,
> Vlad
>
> ________________________________________________________________
> erlang-bugs (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-bugs
mailing list