Multiline strings should not allow backslashes to count as whitespace on first line. #19514
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
type-enhancement
A request for a change that isn't a bug
The multiline spec changed at some point to allow backslashes before whitespace characters on the first line, and still ignore the first line.
I see not need for this complication, and I think it should be removed again.
I can understand the wish to have a single newline at the start of a multiline string not count, so all the lines of the multiline string start at the same offset.
I can understand allowing invisible whitespace before the newline, because it's impossible to see and having it change your behavior would be bad.
I see absolutely no need for allowing visible backslashes. These characters are NOT part of the string, there is no need or even rationale for "string escaping" to work. If anything, if string escaping is allowed, I would expect the line to be part of the string proper.
What was the reason for making this change?
See also issue #14073 (which includes the text from before allowing backlashes) - we haven't specified what the "first line" of a string is, because we haven't specified what a "line" is in Dart source, and it isn't obvious.
If we change the NEWLINE production to allow "CR NL" as a single line terminator (which implementations already do, and will keep doing), then the WHITESPACE production no longer specifies single characters, and the text needs rewriting anyway. Is the sequence BACKSLASH CR BACKSLASH NL part of the "first line of whitespace"?
The text was updated successfully, but these errors were encountered: