Other nice thing I would suggest:
Allow to actual implement a header with a default implementation. A possible use case is this one:
Copy code
header fun ByteArray.copyRangeTo(srcPos: Int, dst: ByteArray, dstPos: Int, count: Int) {
for (n in 0 until count) dst[dstPos + n] = this[srcPos + n]
}
Here I provide a generic implementation, that can be improved using System.arraycopy in JVM or the former for JS typed arrays, but as an optimization, not mandatory. So for example I wouldn’t have to implement for Konan at the very beginning and implement it later when optimizing things
u
udalov
09/21/2017, 12:41 PM
Interesting idea! Please report it as a feature request at kotl.in/issue