Philip Dukhov
05/06/2021, 6:10 AMSealed.Subclass
, but is there a way to define new subclass in an other file but still be able to have it inside Sealed
"namespace"?
class Sealed.NewSubclass: Sealed()
is not possible, but maybe there's an alternative?
The reason why I need it is because I wanna generate some of sealed subclasses, and it's very convenient to have all subclasses under single namespaceephemient
05/06/2021, 6:12 AMephemient
05/06/2021, 6:13 AMPhilip Dukhov
05/06/2021, 7:23 AMSealed
here: I'm using an architecture where each feature has it's own Msg
class, in my code it's inside an object Feature
. So I can find all my messages under Feature.Msg.Msg1
, and if I just place all messages inside a package I'll have to write this package inside the code, and I can't even import it with an alias: when I have many features in a single file, I import those like import com.package.Feature.Msg as FeatureMsg
And can easily get all my msgs under FeatureMsg.Msg
1
spand
05/06/2021, 7:35 AMOther classes or interfaces in the same compilation unit and in the package may implement or extend the sealed class
https://github.com/Kotlin/KEEP/blob/master/proposals/sealed-interface-freedom.mdPhilip Dukhov
05/06/2021, 8:13 AMspand
05/06/2021, 9:07 AMspand
05/06/2021, 9:08 AMPhilip Dukhov
05/06/2021, 9:24 AM