I think we actually are in “violent agreement” here, Alex, but just to be sure, 
see comments below.
 
> On Apr 22, 2019, at 3:04 PM, Alex Buckley <alex.buck...@oracle.com> wrote:
> 
> Nope, I don't think multi-line string literals are an attractive nuisance in 
> any way. We should NOT deem it incorrect to refactor a sequence of 
> concatenations into a single multi-line string literal.

I didn’t say (or mean to imply that).  I think it’s a great thing to refactor 
concatenations into a single multi-line string literal WHEN IT IS DONE 
CORRECTLY.

However, if you blindly pull out the concatenations and thereby introduce 
newlines into the string when they were not there before and doing so violates 
some contract downstream, THAT IS AN INCORRECT TRANSFORMATION.

We certainly agree that it would be a good thing if everything that might be 
downstream were in fact reasonably tolerant of newlines.

BUT IF YOU DON’T KNOW FOR SURE THAT WHAT IS DOWNSTREAM IS TOLERANT OF NEWLINES, 
AND YOU BLINDLY TRANSFORM A STRING CONCATENATION INTO A MULTI-LINE STRING 
LITERAL THAT INCLUDES NEWLINES WHERE THERE WERE NONE BEFORE, THAT IS A BAD 
THING.

And a feature that makes it too easy to accidentally do a bad thing _might_ be 
considered an attractive nuisance, AS OPPOSED TO MY SCREAMING ALL-CAPS, WHICH 
ARE A REPULSIVE NUISANCE.

:-)

> Developers are chomping at the bit to do it, and if we cast doubt on the 
> ability then we're wasting everyone's time. We should deem it correct, and 
> 99% of the time no-one will care that newline characters exist in the string. 
> The rare library that subtly misbehaves or (and this is the better option) 
> actually blow ups when seeing newlines will feel great pressure to become 
> more liberal in what it accepts, and that is a good thing.

And it would probably also be a good thing to have a way to say that a newline 
in the string literal should not be part of the string content.  C programmers 
are certainly quite used to sticking a backslash in front of a newline to mean 
“not really a newline here”.

Reply via email to