String reboot - (1a) incidental whitespace
Guy Steele
guy.steele at oracle.com
Fri Apr 19 18:16:09 UTC 2019
> On Apr 19, 2019, at 2:09 PM, Liam Miller-Cushon <cushon at google.com> wrote:
>
> . . .
> Maybe more interesting is that the both following work as an alternative pattern;
>
> String m = """I won’t
> get any alignment
> (except maybe NL normalization)
> """;
>
> My concern is that you can't tell from reading the code whether that works because the implementation ignores the first line, or because it uses the column position for re-indentation, so you might expect it to be equivalent to:
>
> String m = """ I won’t
> get any alignment
> (except maybe NL normalization)
> """;
Well, that’s right. I would regard the second example as misleading.
I don’t think we can make the rules idiot-proof against such misleading examples. I do think it’s a reasonable goal that the intent of a properly written string literal should be fairly clear even to a reader who does not know the precise rules. And it’s not unreasonable to expect that when you’re writing code, you need to know the rules about how things work. That said, we do want the rules to be simple and easy to remember.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190419/9fbee797/attachment-0001.html>
More information about the amber-spec-experts
mailing list