Is there any plans about embed objects? At the mom...
# language-proposals
r
Is there any plans about embed objects? At the moment we should write
Copy code
class Product(val title: String, val description: String)
class Electronics(title: String, description: String, val memory: Long) : Product(title, description)
class Clothing(title: String, description: String, val size: Long) : Product(title, description)
it will more nice to do like
class Clothing(embed product: Product, val size: Long)
and not to duplicate everytime
title: String, description: String
in child constructor
👍 1
g
This would be really nice. I also faced that issue and wished to have some support from the compiler, but what could be problematic is, if the base-class has two constructors like
Copy code
class Product(val title: String, val description: String) {
    constructor(val title: String, val description: String, val other: String) : this(title, description) {

    }
}
Or do you think about just to support the primary constructor (what is totally fine I guess)