4 ms·
Java still has a ways to go before it catches up with the features of scala. Here are a couple: I'm sure others have said it, but type aliases can't be done in
by jay-anderson 10y ago
Java still has a ways to go before it catches up with the features of scala. Here are a couple:
I'm sure others have said it, but type aliases can't be done in java. For instance this is useful for seeing 'PersonId' instead of 'String'. More semantically meaningful names. You can emulate it in java, but you incur a runtime cost and have to write a wrapper class.
Another interesting feature is value types. There is work in java to support this, but it's java 10 at the earliest (see https://en.wikipedia.org/wiki/Project_Valhalla_(Java_language) https://en.wikipedia.org/wiki/Project_Valhalla_(Java_languag...). Since scala runs on the JVM which doesn't support value types there are cases where it has to allocate an object. (see http://docs.scala-lang.org/overviews/core/value-classes.html http://docs.scala-lang.org/overviews/core/value-classes.html)