Multiline string literals
Per Bothner
per at bothner.com
Sat Aug 6 08:12:22 PDT 2011
On 08/06/2011 03:41 AM, Peter Reilly wrote:
> Now that jdk7 is released and there will shortly be a process for
> asking for new small features in jdk8, I would like to ask that
> support for multiline string literals be considered.
>
> This is a long standing request and a specific proposal is contained in:
>
> http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/000087.html
I think it would be a mistake for multiline string literals to have
the ending delimiter be the same as the starting delimiter. It seems
lie it would make things more difficult for IDEs. Using """ also seems
prone to syntax errors with possibly-confusing error messages. And it makes
it harder to scan the text (visually or with tools) for matching delimiters.
I also think this is a questionable idea:
String platformDepended="""q
""";
is 'q\n' if compiled on Unix and 'q\n\r' if compiled on Windows.
This make the meaning of a program depend on which platform
it is compiled on. Probably not something we want. You could
change it to depend on the program it is *run* on, by defining it
in terms of line.separator - that would make more sense.
--
--Per Bothner
per at bothner.com http://per.bothner.com/
More information about the coin-dev
mailing list