https://kotlinlang.org logo
k

Karlo Lozovina

04/02/2021, 8:57 AM
Are there any plans to support module-wide sealed classes?
👍 1
m

mkrussel

04/02/2021, 11:55 AM
I guess these are still restricted to same package.
so maybe not what you wanted
k

Karlo Lozovina

04/02/2021, 5:48 PM
yup, package-wide works great, it's a welcome addition in some cases but module wide would come in handy sometimes too, or maybe like Java does it, with specifying all the sub classes..
d

dmitriy.novozhilov

04/05/2021, 10:21 AM
What is your usecase for module-wide sealed inheritors?
or maybe like Java does it, with specifying all the sub classes
This never happens because of at least two reasons: - too much useless verbosity -
expect sealed
classes can't work in such scheme, because it's allowed to add new inheritors only for
actual sealed
class
k

Karlo Lozovina

04/05/2021, 9:31 PM
it was mostly a very large class hierarchy with lots of code in each class... having everything in one package is definitely doable, but it would be maybe a bit better to be able to organise it in a package hierarchy being able to have sealed classes in separate files does the job in 99% of the cases...
2
2 Views