[erlang-questions] atoms with newlines

Vlad Dumitrescu <>
Tue Feb 18 22:33:55 CET 2014

On Tue, Feb 18, 2014 at 9:30 PM, Richard A. O'Keefe <>wrote:

> On 19/02/2014, at 3:04 AM, Vlad Dumitrescu wrote:
> > Multi-line strings are a pain but at least I can understand the reason
> for having them. I can't find any reasonable use of atoms with names
> including newlines and I wonder if we could do anything about them...
> Since list_to_atom/1 can create atoms containing newlines,
> then we had _better_ be able to print them somehow.
Yes, I know, I was just a bit frustrated. Maybe it's a thing for Erlang2 o

> There's one thing about Erlang atom reading that may be
> an oversight, and is dangerously close to a bug:
> m% ./erl
> Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:2:2]
> [async-threads:10] [hipe] [kernel-poll:false]
> Eshell V5.10.4  (abort with ^G)
> 1> 'foo\n\
> 1> bar'.
> 'foo\n\nbar'
> I had expected that <backslash><newline> would
> - be rejected as a syntax error, or
> - be discarded like in C and Prolog.
> I did _not_ expect it to turn into <newline>.
Actually, what I was referring to was that that last backslash isn't really
needed at all. 'foo
bar' is 'foo\nbar'. This is what I think is confusing. For strings too.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140218/bc3db9bc/attachment.html>

More information about the erlang-questions mailing list