RFR: Multi-line String Literal (Preview) JEP [EG Draft]
Alex Buckley
alex.buckley at oracle.com
Wed May 15 18:11:44 UTC 2019
On 5/15/2019 10:17 AM, Dan Smith wrote:
> I think this:
>
> ~~~
> String code = """
> public void print(""" + type + """
> o) {
> System.out.println(Objects.toString(o));
> }
> """;
> ~~~
>
> should be presented like this:
>
> ~~~
> String code = """
> public void print(""" +
> type +
> """
> o) {
> System.out.println(Objects.toString(o));
> }
> """;
> ~~~
>
> It's not great, and replace/format is the "right" solution, but if
> somebody wants to do concatenation, this style does a better job of
> indicating where the indent prefix ends and the content begins. The
> delimiter gives a visual indication of where the "block" is located.
I appreciate that you want to position an opening delimiter to the left
of its content, but can you say why you want `type +` on its own line?
What's the big deal with `...""" + type +\n` and then the next text
block? (You don't seem to object to the closing delimiter sharing a line
with content, since you have ` + ` after the first closing delimiter.)
Alex
More information about the amber-spec-experts
mailing list