https://kotlinlang.org logo
#announcements
Title
# announcements
t

Travis Griggs

10/29/2019, 5:55 PM
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

Burkhard

10/29/2019, 6:03 PM
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

karelpeeters

10/29/2019, 7:38 PM
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.