PROPOSAL: Multiline strings

Stefan Schulz schulz at
Sun Mar 8 10:17:04 PDT 2009

I quite liked the idea of handling newlines by adding methods to String, 
to overcome magic conversions. When reading back about indentation etc., 
I wonder, why not to apply a similar technique to get rid of 
indent-related white spaces.

Another question on multi-line Strings I have: does it make sense to 
allow a multi-line String only having one line? If not, why not using 
the sequence double-quote plus newline as marker for multi-line Strings? 
But maybe I overlook the significance in using a seperate marker here or 
problems that might occur during compilation.

According to the above thoughts, the following would assign a multi-line 

String myString = "
     SELECT name
       FROM persons
       WHERE age > 21";

And one could invoke some additional methods on it, e.g.:

myString.removeIndents(); // first line defines indent
myString.removeWhitespaces(); // HTML style space removal

I don't think that wrong indentation inside a String should lead to a 
compiler error, that's why methods like above would suffice IMO. All the 
compiler would have to do is to automatically add (platform specific) 
line breaks.


More information about the coin-dev mailing list