Add support for u128
Hi,
It seems that u128 is not supported out of box. I think we should fix it
The challenge here is probably bindings - eg, how would Kotlin use it?
Even Swift has added support for 128-bit integer types recently: https://developer.apple.com/documentation/swift/int128, so it seems the only issue is Kotlin Multiplatform here (Java has BigInteger; see below). It would be great if we could pass u128 directly; it is useful for passing UUIDs.
First-party bindgens
- Python:
int - Swift:
Int128andUInt128in Swift 6 (iOS 18+, macOS 15+) - Kotlin/JVM:
java.math.BigInteger - Ruby:
Integerin CRuby 2.4+
Third-party bindgens
- JavaScript:
BigInt - Kotlin Multiplatform: :cry:
- Go:
Intin"math/big" - C#:
System.Int128andSystem.UInt128in .NET 7+, orSystem.Numerics.BigInteger - Dart:
BigIntindart:core - Java:
java.math.BigInteger
When the FFI-1.0 proposal is completed, I think we can make our own library that implements 128-bit integers.
Not sure if that's the way out but if Kotlin does not support u128, then we could default to String conversion. This is what I am doing at the moment with protobuf which does not support u128 out of box.