df
11/24/2023, 1:42 AMvar discount: Discount = discount.also { it.constraints = this }
set(value) {
field = value
field.constraints = this
}
Somehow I would like to avoid the duplicated code.ephemient
11/24/2023, 3:56 AMvar x
set(value) {
if (value != field) notifyChange(field, value)
field = value
}
val changes = mutableListOf()
fun notifyChange(old, new) {
changes.add(old to new)
would be problematic as both field
and the rest of the class are not yet initializedephemient
11/24/2023, 3:57 AMephemient
11/24/2023, 3:59 AMdf
11/24/2023, 12:08 PM