Hi Kotlin team, is there any chance we might get e...
# language-proposals
o
Hi Kotlin team, is there any chance we might get extendable enum classes in Kotlin? Right now the way to do this is to have sealed classes which can extend from other case classes, but this is not optimal since these are not singletons and probably there's performance reasons too (I want to cover hundreds of enumerations). Use case? If I have an enum with 200 members, some should be grouped in a separate subcategory as to no litter other subcategories where others don't make sense.
e
Just define an interface and have different enums with reasonable number of members (enum for each subcategory) implement this interface. It is pretty extendable.
o
This works if I just want to split enums into categories, but I'd also want to have a hierarchy, e.g. some enums common to several sub-categories. I can extend interfaces with enums but I can't extend enum classes.
e
You can have hierarchy of interfaces with enums at the bottom.