[erlang-questions] Indentation of multiline strings

Loïc Hoguin essen@REDACTED
Tue Feb 11 01:16:48 CET 2014


On 02/11/2014 01:12 AM, Richard A. O'Keefe wrote:
> 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?

Actually the example above is also legal in Erlang. You don't need to 
use ++ if you only have literals. It also works in binaries:

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

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list