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

Brian Goetz brian.goetz at oracle.com
Mon Sep 30 15:59:49 UTC 2019

> 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…

In some sense, the line was already blurry, because existing “single line strings” could have embedded \n newlines in them.  IMO a better pedagogical model is “one dimensional vs two dimensional” string literals, but this may be a hard sell.  

In a world without \n, I think it would still be pedagogically simple: a “legacy” string literal is a single line of OUTPUT, and a text block can have multiple lines of output.  The presense of \<nl> merely changes how the _input_ is organized.  

My conclusion is that, while the clamoring that inspired us to do this feature is “give us multi-line strings”, to the extent we continue to call them multi-line strings, we play into this confusion.  

More information about the amber-spec-observers mailing list