With closures being added to Java, what is Scala's advantage over Java as a language choice?
Can someone elaborate on any advantages?
With closures being added to Java, what is Scala's advantage over Java as a language choice?
Can someone elaborate on any advantages?
Apart from closures (which Java doesn't appear all that close to having), here's a list of features in Scala that are missing from Java. I'll omit libraries here and concentrate on the features of the language itself. This is not comprehensive by any means, but I think it contains the big ticket items.
for
comprehensionsval
s are as easy to declare as var
s)Some cool secondary constructs that these building blocks enable:
Lastly, I'll mention that Scala has a REPL (read-evaluate-print-loop)--not really a feature of the language itself, but it's very nice to have!
Even if Java 7 [8,..] will have first-class functions one day, it still lacks for implicits, type inference, powerful Collections library, pattern matching, traits and lots of other things boosting productivity. Not talking about various Actor libraries, rich capabilities of building DSLs,...
The latest I've heard is that closures won't make it into Java 7.
http://www.baptiste-wicht.com/2010/09/jdk-7-features-updated-plan-b-is-apparently-here/
http://openjdk.java.net/projects/jdk7/features/
The second link clearly lists project Lambda (closures) as deferred to JDK 8.