Kotlin have `internal` modifier that it is module ...
# language-evolution
p
Kotlin have
internal
modifier that it is module wide. Why not to make
sealed
classes also module wide? I have lot of cases in my code where declaration of base class is in somePackage and all inherited classes in somePackage.subPackage. Now it is not possible to use sealed classes such way.
👍 2
m
Yes, it makes sense to extend sealed classes freedom to the whole compilation unit: https://youtrack.jetbrains.com/issue/KT-22286/Support-interfaces-with-ability-to-extend-[…]implement-them-only-in-the-same-module-sealed-on-steroids We haven't prioritized this issue yet, so feel free to leave your comment and vote for the issue. As for the reasoning: it was much simpler for the compiler and IDE to keep it within the same package, as that dramatically reduces the number of places where the compiler needs to check inheritors of sealed classes and use that information for exhaustiveness. Additionally, there may be some questions with regard to multiplatform, since the notion of a module is slightly trickier there. All of that is solvable, it just requires proper design and good technique
thank you color 2