JDK-8227870 - Escape Sequences For Line Continuation and White Space (Preview)

Jim Laskey james.laskey at oracle.com
Mon Sep 30 15:36:47 UTC 2019


In line.

> On Sep 30, 2019, at 12:29 PM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
> 
> Hi,
> in general I see where the enhancements are coming from - but I do have some comments.
> 
> One is pedagogical; I think a world where single line strings are denoted by a single double quote, whereas multi line strings are denoted by triple double quotes is a relatively wimple world for the user to grok. This proposal effectively blurs the line between the two variants, as now you can (in the degenerate case where all lines in a text block ends with '\') express a single line string with a text block syntax - which I understand is the part of the goal, but...

And String s = "aa\nbb\ncc\n" is truly single line? I think they are just the same thing wearing different clothes.

> 
> The other perplexity is on the use of \s with text blocks; I don't get why the output in your example ends up being:
> 
> red<one space><new line>green<one space><new line>blue<one space><blue line>
> 
> Why is the space at the left of the '\s' being ignored? In fact, '\s' is the _only_ thing you can put in that place that will cause the previous space to be ignored and dropped on the floor, which makes me uncomfortable. I think that, to get the output you want, '\s' should be close to the end of red/green/blue - if, on the other hand, if you add space and _then_ you add a '/s', I don't think we should treat this differently from adding space and then some _random_ character - in which case all the space in between will be preserved.

This is a readability issue in the edits. It's actually "red....\ngreen..\nblue...\n". I'll fix.

> 
> Maurizio
> 
> 
> On 30/09/2019 12:45, Jim Laskey wrote:
>> During the discussion on Text Blocks, several of you stated a need for a line continuation construct. I have since created a CSR to propose the creation of two new escape sequences: \<line terminator> and \s.
>> 
>> 	https://bugs.openjdk.java.net/browse/JDK-8227870
>> 
>> 
>> Please review and comment here.
>> 
>> Cheers,
>> 
>> -- Jim
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190930/11fa1cf4/attachment.html>


More information about the amber-spec-experts mailing list