|
|
|
|
|
by hota_mazi
3383 days ago
|
|
The main difference is that Kotlin can do both: nullable types or `Option` (and you'd never use `Option` unless you are dealing with it coming from Java, obviously). Scala can only do `Option` since it doesn't have built in support for nullable types. I fail to see how your point shows any superiority from Scala here, it's the other way around. At the end of the day, both languages have nullability support but since it's optional in Scala (because library based), Kotlin's approach is superior in that it requires developers to deal with nullability, while Scala developers can ignore it any time they want. |
|
> Kotlin's approach is superior in that it requires developers to deal with nullability
But it doesn't force them to deal with nullability when interacting with Java which is the only case where it matters.
Scala calling Scala: you never use null, you never hit a problem with null.
Scala calling Java: you have to manually check return values for older libraries but at least passing in null can't happen.
Kotlin calling Kotlin: you use null a lot, you never hit a problem with null.
Kotlin calling Java: you have to manually check return values for older libraries and won't notice where you're passing in null because that's a normal, safe thing to do when calling Kotlin.