KEEP
KEEP copied to clipboard
KEEP for multi-field value classes
There is another use-case I would like to share:
Here: https://docs.korge.org/ktcc/
There I'm doing black magic tricks that are really dirty to avoid allocations, and the code looks ugly. Being able to have something like:
value class MyPointer(val buffer: Buffer, val offset: Int) {
var x: Double get() = buffer.getDouble(0); set(value) { buffer.setDouble(0, value) }
var y: Double get() = buffer.getDouble(8); set(value) { buffer.setDouble(8, value) }
}
That would help to have C-like pointers: an array or buffer + offset (+ maybe optionally size)