Raw String Literals (RSL) - indent stripping of multi-line strings

Kevin Bourrillion kevinb at google.com
Fri Apr 27 19:25:16 UTC 2018

On Mon, Apr 23, 2018 at 10:04 AM, Jim Laskey <james.laskey at oracle.com>

Samples of multi-line RSL styles (periods represent incidental indentation):
>     String a = `line one
> ................line two`;

A point my coworker Guy Bensky brought up to me is that if we were willing
to outlaw style A -- that is, require newline after opening delimiter for
any *multi-line* RSL -- then indentation-stripping behavior would get far
easier to specify and explain. It always eats a newline, then it simply
removes common indentation from all lines.

I agree that generally we want to leave stylistic freedom to users, but if
we do believe most users want that aforementioned "rectangle rule", then
style A is inferior to the rest anyway, because its rectangleness is broken
the second you rename the identifier. (Nevertheless, I know that some users
would *like* to do style A anyway.)

No strong feelings on this, but thought it maybe a point to consider.

Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com

More information about the amber-dev mailing list