https://kotlinlang.org logo
#announcements
Title
# announcements
c

cedric

12/03/2017, 4:09 AM
Kotlin doesn't natively support sum types, so using
Either
is still error prone: the compiler won't prevent you from accessing the field that's not been set
r

raulraja

12/03/2017, 11:17 AM
The encoding on Either does not use fields but an ADT. Kotlin has support for encoding sum types via ADTs if not through direct syntax. That is the same as Scala.
So the compiler does guarantee that and using either is never error prone unless you add unsafe methods to it which Kategory's Either does not have.
4 Views