PROPOSAL: Multiline strings
Reinier Zwitserloot
rzwitserloot.pop at gmail.com
Sun Mar 8 14:37:43 PDT 2009
Triple dquotes means you don't have to escape any single dquotes
except at the end.
The default should clearly be to strip indent; NOT doing this is the
exception, some toying about with exact syntax rules, and a good
review of YAML should help sort it out.
--Reinier Zwitserloot
On 8 mrt 2009, at 18:17, Stefan Schulz <schulz at e-spirit.de> wrote:
> 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:
>
> 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.
>
> Stefan
>
More information about the coin-dev
mailing list