Would it be feasible to declare nested classes in ...
# language-proposals
z
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
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
What nesting buys you in this case? You can name it
MyViewModelState
. Would it work or?
z
That definitely works. I just prefer the
MyViewModel.State
naming
Would also be cool to be about to nest under typealiases