Escape Sequences For Managing Whitespace (Preview)

Alex Buckley alex.buckley at
Tue Aug 13 20:51:57 UTC 2019

- Title: "Escape Sequences for Line Continuation and White Space 
(Preview)"  (the narrative term is "white space" per the JLS and JEP 
355; the only time the ` ` character after "white" is missing is in the 
name of the grammar production WhiteSpace)

- Goal: "Improve the the observability of the space (U+0020) character 
in string literals." -- not sure that's ever been a huge problem, and it 
distracts from the real deal which is retaining white space in text 
blocks. Recommend deletion.

- \040 is introduced as the "space escape sequence". Please don't 
confuse people by making them look in JLS 3.10.6 for a non-existent 
sequence; please reuse how JEP 355 introduced \040.

- In the retaining white space section, the argument is slightly 
mis-ordered. You show the \040\040\040\040 example, then say it's arcane 
(yes) and the \040 escape is perplexing (yes) and that readability could 
be enhanced (yes) but then you double down on \040 by showing it as a 
fence in the `red   \040` example. Better to show the \040\040\040\040 
example, then say "don't worry, you don't need that whole ugly sequence, 
you only need one \040, it's called a fence, look:" then show the `red 
\040` example, THEN say that \040 is arcane and a better escape is needed.

- "Strings that require using backslash as a character can use the \\ 
escape sequence. This is also true at the end of line." -- please say 
that \\ works because Java does not do recursive processing of escape 
sequences -- once \\ has been processed to \, the \ and the following NL 
are NOT further processed to a line terminator. Being explicit about how 
escape processing works will keep us sane as we grow the "escape 
language" whose processing is split across JLS and API.

- General: example code shown in the Motivation should be reused in the 
Description but with the new escape sequences. You use lorem ipsum for a 
concatenated string literal in Motivation, use it again in Description! 
Same for the red green blue example, which is much better than x yy zzz.

- The Alternatives for Line Continuation talk about long string 
literals, then show text block examples. Since \<LT> works in a string 
literal, I was expecting a story which ignores text blocks and talks 
only of improved string literals. Too many things varying at once.

- Reading "Replacing marker sequence (plus newline) with empty string", 
I realized the `...` is another kind of fence -- rather than preventing 
trailing white space for going beyond itself (the definition of a 
fence), it prevents the entire line going beyond itself. Consider saying 
"In a text block, the newline is an implicit fence; a more explicit 
fence can be made not just with \<LT> but with any character sequence, 
e.g. `...` or `$`, which is then replaced along with the 
immediately-following newline."


On 8/13/2019 5:46 AM, Jim Laskey wrote:
> Comment back to this list, thank you.
> Cheers,
> -- Jim

More information about the amber-spec-experts mailing list