| 1) There is a literal syntax for Java: entries = new ArrayList<Integer>() {{
add(3);
add(4);
}} But yes, certainly not as elegant as Scala. Having said that, you don't encounter literal collections very often (except maybe in tests). 6) Named parameters are pretty easy to emulate: new Window().width(100).height(50) although the builder pattern is safer: Window w = new Window.Builder().width(100).height(50).build(); 7) No more checked exceptions: celebrating this is like saying that your code is shorter because you no longer bother checking for errors. 8) You can only omit parenthese in Scala when there is exactly one parameter: x.foo a <-- legal x.foo a b <-- illegal x.foo(a, b) <-- legal One of the many syntactic quirks that Scala suffers from 9) Comprehensions are neat but they suffer from a crippled performance limitation that forces you to revert to imperative loops, even in optimized mode. This technical problem is serious and there is no solution in sight at the moment. There are genuine reasons to be excited about Scala but this article makes me think that the author just discovered Scala and they haven't really dug very deep yet. When you do, you start realizing that Scala's nice features are offset by quite a few annoying limitations that will probably doom this language to a niche. |
Nah, entries = Arrays.asList(3, 4);
Scala is pretty sweet with a lot of syntactic sugars, but it still it doesn't fundamentally make writing correct code any faster, especially for Java developers who are competent with their IDEs. Until Scala's compile time and IDE support improves 10x, I see no point of using Scala for production code.
Slightly more verbose Java syntax is more than made up by the instant/incremental compilation/autocompletion/refactor that works. Even as a Java noob (I'm more experienced in C++), I can bang out correct code the first time without going through any edit/compile cycles, most of the time. IDE is the new REPL and language snobs always forget that.