PROPOSAL: String literals: version 1.1

Stephen Colebourne scolebourne at joda.org
Tue Mar 3 04:08:36 PST 2009


rssh at gradsoft.com.ua wrote:
>> I don't think you need the U/W suffix; make all newlines \n regardless
>> of what they are in the source file. If this annoys anybody, they can
>> either manually add the \r in the string, or run a
>> simple .replace("\n", "\r\n") at the end. I find collapsing whitespace
> 
> 
> 1. We must be able easy receive string in 'platform native' encoding.
>  (If i wrote application, which generate part of text file, which I later
> will open in text editor: this is matter)
> 
> 2. Hmm, in principle for me difference between suffix and method of string
> is not big (and smart compiler will be call this methods on constants
> during compilation)
> 
> So, in principle suffixes can be changed to 3 methods
> 
>  nativeLf()  -  replace '\r\n'|'\n' to line terminaton sequence, native
> for this platform.
>  unixLf() - replace '\r\n' to '\n'
>  windowsLf() - replace '\n' to '\r\n'
> 
> 3. I does not like names like unixLf() or windowsLf()
>  Are you have any ideas about better names ?

I would recommend doing a thorough survey of what other languages do for 
multi-line strings, including Groovy, Scala, Fan, Python, C# and any 
others you can think of. Try to find the common design.

Stephen



More information about the coin-dev mailing list