Special support for serializing Kotlin’s `object` ...
# serialization
t
> Special support for serializing Kotlin’s
object
Is there any example on this theme? What is use case for
object
?
z
One is sealed classes that have
object
children.
t
Has it sense outside sealed class?
z
I’m sure someone can come up with a use case for it ¯\_(ツ)_/¯
c
Maybe if the object has mutable state that you want to preserve across application restarts?
k
object
serialization is useful in other polymorphic situations too, I'd assume.
s
Initially that was the issue: https://github.com/Kotlin/kotlinx.serialization/issues/400. So it looks like indeed objects are useful in polymorphic situations
a
Actually we are currently creating a lot of inner classes without any parameters just for serialization
They should be like object Unknown : State() but is class Unknown() : State()
s
Well, it seems that you should give this new feature a try