4 ms·
I've been playing with CoffeeScript and Ruby lately, and was very weirded out by the lack of parentheses in method calls, til I started to see them as bash-like
by 6ren 15y ago
I've been playing with CoffeeScript and Ruby lately, and was very weirded out by the lack of parentheses in method calls, til I started to see them as bash-like (but more sophisticated of course), where you just add the arguments. Ruby used to be called a "scripting" language after all.
Another characteristic of "scripting" languages is ease of file handling. Java is not a scripting language. Previously, if you wanted to copy from one stream to another, you had to write a loop (maybe you still do, and this "copy" is strictly for files?). Simple; but nice if they provided a cat() method. It's quite amazing how popular Java is (and how useful it must be in other areas), considering this kind of trivial shortcoming.
- lsd5you 15y agoFor streaming a loop, the point is they have left that to programmers/library designers to implement these functions. Since there are a number of considerations, buffer size, error management ... etc. it does in fact make sense to not have just one sanctioned implementation for this.
- alt_ 15y agoNIO FileChannels have a transferTo() method[1]. I expect they only added it once they found a good enough reason (zero-copy). The standardization process moves so slow that convenience functions are better served by third-party libraries. [1] http://docs.oracle.com/javase/1.4.2/docs/api/java/nio/channels/FileChannel.html#transferTo(long,%20long,%20java.nio.channels.WritableByteChannel) http://docs.oracle.com/javase/1.4.2/docs/api/java/nio/channe...