Oh, and also, could you define a union type in Kot...
# announcements
a
Oh, and also, could you define a union type in Kotlin?
h
r
Using data structures like Either enhanced with kotlin's smart casts come at least close but for now you wont be able to have real union types, only distinct union types. Meaning, you can do
Copy code
val e: Either<String, Int> = Left("hello")
e = Right(1);
but you cannot do the following:
Copy code
val e: String|Int = "hello"
e = 1
k
There's some discussion with the Kotlin devs on both of your questions here: https://discuss.kotlinlang.org/t/any-thoughts-on-ceylon-style-union-and-intersection-types/547