Why `abstract` can be `inner`, but `sealed`, `data...
# getting-started
l
Why
abstract
can be
inner
, but
sealed
,
data
not?
In general it's just a design decision, rather than a technical limitation
l
For data class I can compromise, but sealed class I don't think it's convincing. My use case suggests me to use exhaustive when while each subclass holding a reference of the outer class because I need the generic type. For now I need to re-declare that generic type, and you can see it's treated differently on this aspect between abstract and sealed.
g
For sealed it's by historical reasons, originally it was possible to declare a sealed class only on top level https://discuss.kotlinlang.org/t/sealed-inner-classes/2371/7
🥲 1