What are advantages of Scala over Kotlin?
By William Narmontas,
Original article at Quora.
Scala leads, others follow. Scala offers:
-
A far stronger and more sound type system
- Type classes & implicits
- Higher kinded types: are types which take other types and construct a new type, mostly used for Functional and Generic programming, see libraries like Cats, Scalaz and Shapeless.
- Still work in progress to build Scala 3 (Dotty) to have a language based on sound theory
- This enables an incredible amount of things such as automatically deriving information from your types, creating complex types from other types, and treating types almost as if they were values.
-
Excellent, scalable tooling
-
SBT - Scalable Build Tool
- Custom, cheap plugins in-project - you can extract common functionality from multiple projects for your team. Your build is code meaning you can publish it, transform it, factor it out, etc
- Easy packaging and deployment to Docker and other targets
- Strongly typed, as it is written in Scala, and with macros
- Play Framework - which actually scales in development, unlike every other framework I’ve used
- Akka
-
SBT - Scalable Build Tool
-
Macros and code introspection (scalameta; PDF slides)
- Basically write code to analyse and generate other code
- Enable automatic yet explicit type class derivation, such as for JSON formats (also done with generic programming)
- Enables tools such as shapeless, scalafmt, scalafix
I have not listed everything, but this is more than enough to start with.
Right now, Kotlin and Scala are not really competitors as they are in a different ballpark in terms of offerings. Different target markets.
The way I see it, Kotlin will make it possible for programmers to appreciate what Scala has to offer.
Make no mistake about it: Scala scales, hence the name.