Re:Dart language
by dextorious on Monday October 10, 2011 @10:17AM
(#3093832)
Well, for one you can probably make your own "+=" for strings, if not available, since Dart has operator overloading.
Also, System.getProperty("line.separator") does not translate to n"\n".
The first makes your program more portable. Of course it could be made accesible easier, eg as a constant System.NEWLINE or something.
[UPDATE] Downvote? Really? Because someone thinks "\n" is the same as "line.separator"?
Indeed they do not translate into the same thing. But neither makes your program more or less portable in itself. It all depends on what you want to use it for. Some files and protocols should always have \n some always \r\n while in some cases it should be the system line separator. I think Python, Perl, C, and Ruby have fixed that quite well by making the IO library do the conversions. I do not remember if it is the same in Java.
I didn't downvote, but see universal newline support in Python http://www.python.org/dev/peps/pep-0278/
Trying to open and read a file in Java is probably a better example as the intent (open this file and read the contents) is buried in about 6 lines of boilerplate code
I use Java as an example because in a previous life I used to write it and see this as perfectly acceptable