I hate Java’s lack of unsigned values, particularl...
# announcements
t
I hate Java’s lack of unsigned values, particularly that “Byte” should have ever been signed. So I’m loving Kotlin’s Unsigned stuff, especially UByte(Array). Is there any reason NOT to embrace UByte(Array) throughout my app and just translate to/from at the edges when using Android APIs? For example, performance penalties? I notice that there doesn’t seem to be a UByteArrayInput/OutputStream, but I can probably make my own of those.
b
The only reason not to use it is the fact that inline classes are not yet considered stable, so some stuff might still change and break binary/source compatibility. So if you don’t want to use experimental features you shouldn’t use unsinged values, other than that you are good do go IMO.
k
So no, there are no performance disadvantages: that's the point of inline classes. If you want to be sure you can look at the compiled code, whenever possible to compiler wil use a primitive
byte
, no actual instance.