RFR: CSR JDK-8233117 Escape Sequences For Line Continuation and White Space (Preview)

forax at univ-mlv.fr forax at univ-mlv.fr
Tue Nov 5 18:48:57 UTC 2019


> De: "John Rose" <john.r.rose at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "Jim Laskey" <james.laskey at oracle.com>, "compiler-dev"
> <compiler-dev at openjdk.java.net>, "core-libs-dev"
> <core-libs-dev at openjdk.java.net>
> Envoyé: Mardi 5 Novembre 2019 19:35:45
> Objet: Re: RFR: CSR JDK-8233117 Escape Sequences For Line Continuation and White
> Space (Preview)

> On Nov 5, 2019, at 10:17 AM, Remi Forax < [ mailto:forax at univ-mlv.fr |
> forax at univ-mlv.fr ] > wrote:

>> the rationale to add \<newline> is well explain but why do you want to introduce
>> \s given we already have \u0020 ?

> Remi, you are an expert in the field and you got fooled! This is *exactly* why
> we need \s.

> The \uXXXX syntax is expanded *before* token scanning, which means that the poor
> programmer
> who tries \u0020 will see it stripped by the whitespace stripper. Using \uXXXX
> where XXXX is
> an ASCII code point is an anti-pattern! (I think we would help our users if we
> deprecated it.)

I was not thinking of the case where you put a \u0020 inside a text block at the beginning/end of a line :) 
I still think that i prefer to have a clear delimiter like '|' and a calls to replace('|', ' ') like this 

private lazy static final String text = """ 
| this | 
| is | 
| fun | 
""".replace('|', ' '); 

> You might have said \040, but that too is hard to remember and to read and to
> use correctly.
> \s is the answer.

> — John

Rémi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20191105/0a69201c/attachment-0001.html>


More information about the compiler-dev mailing list