Arbitrarily sized ints
The current Int is an int64. We should support ints that are arbitrarily sized.
One open question here is: should Pkl's numbers be arbitrarily sized? Or should we introduce a new type, e.g. BigInt?
What are the use cases, and how common are they?
Retrofitting Int would be a breaking change and might affect runtime and memory performance. It might also increase the likelihood of writing erroneous programs that don’t terminate in a reasonable time.
One use-case is to represent IPv6 addresses, which are 128-bit ints.
One use-case is to represent IPv6 addresses, which are 128-bit ints.
Shouldn’t these be represented by an Ipv6 stdlib class in any case?
Yeah, possibly. Right now this is implemented as a package, and backed by a u128 class; that effort is one of the motivations for this issue.
Another use-case here is to represent epoch microseconds.
The documentation of u128 is 🥇!
Who was it that said we'd never need more than 64 bits??
Another use-case here is to represent epoch microseconds.
FWIW, Java classes such as java.time.Instant don’t use BigInteger anywhere (just long and int).
By the way, if Pkl’s Int was retrofitted to be arbitrarily sized, the Java code generator would need to generate BigInteger.