Why isn't Nothing Serializable by default? did the...
# serialization
a
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
You cannot even get an instance of
Nothing
, can you?
a
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>()
}