https://kotlinlang.org logo
#language-proposals
Title
# language-proposals
z

zak.taccardi

10/18/2019, 4:13 PM
Would it be feasible to declare nested classes in a separate file? For example: I would like to have
MyViewModel
in one file, and
MyViewModel.State
in another file?
I like to use this type of namespacing for organization, but it often causes large files unfortunately
If you could create nested typealiases, that would help too
typealias MyViewModel.State = MyViewModelState
though
MyViewModelState
would still bleed across the module
j

jimn

10/19/2019, 11:17 AM
you can lean on mixins to have this already.
you can have the "big" volume of code in seperate file. nested classes declared in seperate files really doesn't sound inner or nested, or intuitive
e

elizarov

10/24/2019, 11:27 AM
What nesting buys you in this case? You can name it
MyViewModelState
. Would it work or?
z

zak.taccardi

10/24/2019, 2:09 PM
That definitely works. I just prefer the
MyViewModel.State
naming
Would also be cool to be about to nest under typealiases
6 Views