|
|
|
|
|
by CarlSmotricz
5209 days ago
|
|
If that's true, then Scala was simply specified less precisely than Java. As lemming said, Scala is a massive superset of Java's functionality. Off the top of my head, I can rattle off a slew of functionality in Scala that's not in Java: * Regexp literals * partial/curried functions * for comprehension * argument defaults * case classes (and switches thereon) * tuples * combinators * XML interpolation * Mixins * Fine-grained visibility Caveat: I'm no Scala expert. Some of this may be in the libraries and not the language proper. Now... what Java functionality can you name that's not in Scala? |
|
You're right that every bit of complexity Java has also trickles into Scala. For example, Java's broken generics certainly add undesired complexity (type erasure, wonky types) to Scala. Still, I think that idiomatic Scala generally is less complex per unit functionality delivered. It's true that "full Scala" must be more complex than Java because it contains Java as a subset, but I think that more can be accomplished in Scala without making code complex or verbose to the point that it becomes a problem.
In other words, to do comparable things requires far less complexity in Scala than in Java, because Scala delivers the best bang-for-buck by picking the most efficient abstractions. For example, Java concurrency requires a JVM expert to get it right (did you know that doubles and longs aren't thread-safe?) whereas Scala concurrency just requires someone who has a basic understanding of the Actor model.