[erlang-questions] Indentation of multiline strings

Richard A. O'Keefe ok@REDACTED
Tue Feb 11 01:12:48 CET 2014


Emacs is not the only program that doesn't like multiline strings
very much.  One thing ANSI C89 added to Classic C was string pasting,
so that you can write

	"this is a long string literal "
	"that extends across three lines "
	"and each line is visibly (part of) a string."

Some people dislike this, possibly because it _only_ works for
literals.  I very much like the way it lets me indent parts of
strings nicely.

So it is possible to have a language in which you don't *need*
multiline strings.  Could we add this to Erlang?

We don't need to!

	"this is a long string literal " ++
	"that extends across three lines " ++
	"and each line is visibly (part of) a string."

is already legal Erlang, both in expressions and in patterns.

So we can get *long* strings in Erlang without *multiline* strings.

Speaking as a bear of very little brain, _I_ get confused when my
eye falls on a an interior line of a multiline string, so I find
the ++ style noticeably easier to read.

There is the issue of converting multiline text to and from this
form, but you already need to do something smart to handle
embedded ", \, tabs, and/or control characters.





More information about the erlang-questions mailing list