t0yger
11/27/2020, 10:22 AMinterface Test {
val a: String
}
var Test.b: String
get() = field
set(value) = field = value
Tobias Berger
11/27/2020, 10:29 AMprivate val bValues = mutableMapOf<Test, String>()
var Test.b: String?
get() = bValues[this]
set(value) { bValues[this] = value }
but that has MEMORY LEAK written all over it, because the map will keep the Test instances in memory, even if you don't need them anywhere else.Tobias Berger
11/27/2020, 10:32 AMt0yger
11/27/2020, 10:35 AMTobias Berger
11/27/2020, 10:41 AMTest
) defines a ratchet box like this:Tobias Berger
11/27/2020, 10:41 AMhammer
that allows you to pull a hammer from that box or put it in. But there is no space for it in the actual box, because it wasn't designed to contain a hammer.t0yger
11/27/2020, 10:46 AM