Why isn't Nothing Serializable by default? did the serialization team miss a use case for it? or where there ambiguations that led to it being stalled??
v
Vampire
08/03/2022, 2:42 PM
You cannot even get an instance of
Nothing
, can you?
a
andylamax
08/03/2022, 2:45 PM
Yes, you ca't get an instance of Nothing. But this code has to be serializable
Copy code
@Serializable
sealed class Optional<out T> {
object None: Optional<Nothing>()
data class Some<out T>(val value: T) : Optional<T>()
}