String reboot - (1a) incidental whitespace

Liam Miller-Cushon cushon at google.com
Thu Apr 18 17:08:49 UTC 2019


On Thu, Apr 18, 2019 at 8:52 AM Brian Goetz <brian.goetz at oracle.com> wrote:

> I still find the restriction appealing for the opening delimiter, though.
> The argument is that having contents on the opening line seems likely to
> cause confusion, e.g.:
>
>         String m = """    +--------+
>                           |  text  |
>                           +--------+""";
>
> Result of variable m under the current string-tapas prototype:
>
> ....+--------+\n
> |..text..|\n
> +--------+
>
>
> I think this is a restriction that is much more suitable to a _style
> guide_ than the language.  Yes, users can get it wrong, but they’ll learn
> quickly.  And, sometimes putting text on that first line is exactly what
> you want, such as in the case where you _dont_ want alignment to muck with
> your indentation.  Putting non-blank text on that first line is effectively
> an opt-out:
>
>     String m = “””I won’t
>          get any alignment
>          (except maybe NL normalization)
>
>      ”””;
>

I'm not sure that matches the behaviour of the current prototype, it
doesn't seem to be considering the first line:

    String m = """I won’t
         get any alignment
         (except maybe NL normalization)

     """;

Result of variable m
I.won’t\n
....get.any.alignment\n
....(except.maybe.NL.normalization)\n
\n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190418/2b0d23ed/attachment.html>


More information about the amber-spec-experts mailing list