Hacker News new | past | comments | ask | show | jobs | submit login

Scala is actually less complex than Java by far.

I'm sorry, but I can't let this one go by. I can accept the argument that FP may be less complex once you get used to it (not sure I agree but let's go with it) and immutability by default is great but just because Scala and/or it's surrounding community allow or encourage this style doesn't mean that Scala-the-language is less complex than Java-the-language. That's a statement bordering on the absurd - I would say that Scala is demonstrably massively more complex than Java. Many of the things that make Scala great are extremely complicated, both theoretically and practically. That doesn't stop it being great but it does make it complex.




If I recall correctly, the Scala spec is about one-third the size of the Java spec.


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?


Not that this diminishes your point, but many of these features (e.g. case classes and pattern matching, list comprehensions) actually make real-world code less complex.

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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: