|
|
|
|
|
by marc_omorain
3432 days ago
|
|
> "Slightly cleaned-up Java with a bit of syntax sugar" This is not an accurate description of Kotlin. Kotlin has many features that make it better than Java. Most importantly, it is null-safe. In addition to that it makes it simple to enforce data-immutability, which is very difficult in Java. https://kotlinlang.org/docs/reference/comparison-to-java.htm... |
|
Kotlin does have nullability handling yes, but it's a very limited special-case feature - it's a language-level builtin rather than something you can use in your own libraries. E.g. if you want to have an error message in the failure case rather than just null (i.e. some kind of Result type), you can't reuse any of the null-safety functionality (whereas in Scala or Ceylon you can write the same methods to work with either optional/nullable or result-like types).
Data immutability isn't at all difficult in Java. It's tedious (sprinkling "final" everywhere), but not hard.