[erlang-questions] atoms with newlines

Richard A. O'Keefe ok@REDACTED
Fri Feb 28 01:22:12 CET 2014


On 28/02/2014, at 11:14 AM, PAILLEAU Eric wrote:
> I only wondering why \n is allowed in atoms, in general.

Why should \177 be allowed but not \n?

Just because SOME atoms are meant for people to read and write
does not mean that ALL atoms are.

> This would solve your problem...

There are two problems.  One is the problem of writing
long atom names unreadably.  The other is the way that
backslash+newline is accepted but does the opposite of
what you are likely to expect.

> I suppose you have certainly thought to this unsatisfactory solution :
> 
> A = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
> "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
> "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
> "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
> "AAAAAAAAAAAAAAAAAAAAAAA".
> list_to_atom(A).

That does not work in patterns,
and it doesn't work in data structures stored in
files in Erlang syntax.

Maybe this is one of the things that release 17 could fix...




More information about the erlang-questions mailing list