This message was deleted.
# getting-started
s
This message was deleted.
y
additional question: how (un)popular is composition over inheritance in Kotlin? for example, my current issue is that I have
Copy code
sealed interface A {
    val v1: Int
    val v2: String
    
    data class B1(override val v1: Int, override val v2: String) : A
    data class B2(override val v1: Int, override val v2: String) : A
    data class B3(override val v1: Int, override val v2: String) : A
}
and I need to do a
.copy()
in a couple of places. this can also be expressed as
Copy code
data class AK: CompiledGenericRule.Kind(val v1: Int, val v2: String, kind: K) {
    enum class K { B1, B2, B3 }
}
which loses the class-level polymorphism, but is simpler to use and
.copy()
is no longer a problem. but I don't want to introduce this to a codebase where this pattern is not widely if there are some problems here.
k
Why delete the original one if you're using this to do additional questioning?
y
I decided that this is kind of trivial and kind of off-topic. I should have considered this before writing (sorry.)
k
I'd suggest deleting this thread and posting your new question as a top level post
y
I think this extends to the entire discussion tbh, none of this is really worth people's time here.
k
By deleting the original post, you're going to lose a lot of people that will not open this thread at all
y
yeah that's fine. as mentioned, this entire thread was something that should have been discussed elsewhere since it's not Kotlin-specific and not very actionable.