Can anyone explain what `kotlin.native.ImmutableBl...
# kotlin-native
n
Can anyone explain what
kotlin.native.ImmutableBlob
is and how to use it?
d
It's a compile time byte array. Think global
const char array[40];
from C.
n
What does it provide that one could not do with a
ByteArray
for instance? The name blob seems to suggest that it is designed to deal with large arrays, but then in which way does it help? I'm also confused by the word "compile-time". Seems like you can create one anytime you want with
immutableBlobOf()
.
d
"compile time" was the wrong term. Global and static. iirc there are restrictions on where you can call
immutableBlobOf
. I've never used it myself so. 🤷🏼
n
Yeah well compile-time is used in the documentation as well, so it's not your fault 😄 thanks a lot. I have found this issue which adds some info: https://youtrack.jetbrains.com/issue/KT-19787 seems like it was meant to be a hackish way to embed read-only resources into the final executable, but it's still not working well because compilation is very slow.