Ruckus
06/14/2021, 4:59 PMinterface A {
val prop1: ...
val prop2: ...
...
companion object : A {
...
}
}
interface B : A {
val prop3: ...
...
companion object : B, A by A {
...
}
}
Is there a way to do this without the weird interface / companion construct?Ruckus
06/14/2021, 5:04 PMobject A {
val prop1: ...
val prop2: ...
}
object B : A {
val prop3: ...
}
But you obviously cannot extend an object from an object.hho
06/14/2021, 5:04 PMclass
?edrd
06/14/2021, 5:07 PMRuckus
06/14/2021, 5:08 PM// In context regarding the types
with (A) {
doSomething(prop, ...)
}
Ruckus
06/14/2021, 5:09 PMRuckus
06/14/2021, 5:09 PMhho
06/14/2021, 5:14 PMA
and only your "last hierarchy level" needs to be an object
. That way, you can inherit how deep you want (Example). But I'm probably not fully understanding what you're after…Ruckus
06/14/2021, 5:22 PMA
needs to be an object too. The user needs to be able to work within the context of A
if they want, but I also want B
to inherit the context of A
.Ruckus
06/14/2021, 5:26 PMRuckus
06/14/2021, 5:34 PMRuckus
06/14/2021, 5:45 PMPlatformTheme
BuiltInTheme1: PlatformTheme
BuiltInTheme2: PlatformTheme
The user could then choose to use the base platform theme, any of the built in themes, or a custom theme which could either be fully custom or derived from an existing theme. However, the "theme" is essentially just a list of predefined "properties" the user can use.
The actual implementation is a fair amount more complicated, with more than just a Values
context, so I unfortunately cannot just use a simple class structure and throw the Values
in there.Sourabh Rawat
06/14/2021, 9:52 PMRuckus
06/14/2021, 9:55 PMA
in B
. My goal is to get rid of all the duplication I'm currently doing in the companion, not move it somewhere else.Ruckus
06/15/2021, 9:15 PMedrd
06/16/2021, 2:12 PMRuckus
06/16/2021, 2:36 PMhho
06/16/2021, 3:14 PMRuckus
06/16/2021, 3:25 PMedrd
06/17/2021, 3:21 PMRuckus
06/17/2021, 3:23 PM