String reboot - (1a) incidental whitespace
guy.steele at oracle.com
Tue Apr 16 19:57:52 UTC 2019
Actually, let me point out that the rectangle-of-double-quotes syntax is entirely compatible with Jim Laskey’s suggestions; the two can coexist.
Define the rectangle-of-double-quotes syntax to be:
<string-rectangle> ::= <seven or more “ characters in a row> <horizontal-whitespace>* <newline> <intermediate-line>* <whitespace>* <seven or more “ characters in a row>
where <intermediate-line> ::= <horizontal-whitespace>* <string> <horizontal-whitespace>* <newline>
and the meaning of such a <string-rectangle> literal is the concatenation of one string expression for each intermediate line calculated as
<string>.trimRight() + “\n”
where the method trimRight is the obvious method that trims only on the right side of the string.
The only reason for requiring a string-rectangle to begin with at least 7 double quotes in a row is because 6 in a row would presumably be an empty string using """ as delimiters.
In addition one could impose constraints on the lengths of the delimiters, the lengths of the strings, and/or the amount of whitespace at the start of each intermediate line. For example, one might require the two occurrences of <seven or more “ characters in a row> to be the same length.)
So by all means consider Jim’s proposal separately, then please consider the rectangle-of-quotes as one possible way to address the management of indentation and whitespace stripping. This would give users a choice of styles for multiline strings.
> On Apr 16, 2019, at 3:37 PM, Guy Steele <guy.steele at oracle.com> wrote:
> Just in case it wasn’t clear, I want to emphasize that my suggestion of using a rectangle-of-double-quotes was intended as a serious proposal—admittedly one that looks unusual and would require good cooperation from each IDE to be practical, but one that solves a number of the problems about that we are facing about indentation and whether to strip whitespace.
More information about the amber-spec-experts