Re: [Beanshell-users] String Sugar

Artur Biesiadowski <[email protected]> Wed, 08 Dec 2004 21:51:40 +0100
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <[email protected]>
Patrick Niemeyer wrote:

>     " this is the start of a quote
> 
> 
>     on multiple lines"
> 
> 
> Off the top of my head I'm not sure why long lines like this aren't 
> supported in Java or C (without the escape). It seems like something we 
> could support in the future.

IMHO it is because of not-obvious line end characters. If you write

"this is the start of quote\n"+
"\n"+
"\n"+
"on multiple lines\n"+

you think about newlines and on all platforms program will work the 
same. With embedded newlines, after opening file in editor on other 
platform and saving it back without changing anything, you may cause 
program to work in different manner.

For example, what is the result of

"01234
5678".charAt(7) ?

You cannot answer this without knowing on what platform I have written 
the source file.

Artur


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/