Originally created by @bioball on GitHub (Jul 29, 2025).
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?
Originally created by @bioball on GitHub (Jul 29, 2025).
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`?
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.
@odenix commented on GitHub (Aug 14, 2025):
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.
Shouldn’t these be represented by an Ipv6 stdlib class in any case?
@odenix commented on GitHub (Aug 14, 2025):
> 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.
@bioball commented on GitHub (Aug 14, 2025):
Yeah, possibly. Right now this is implemented as a [package](https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/pkl.experimental.net/current/net/IPv6Address.html), and backed by a [u128 class](https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/pkl.experimental.net/current/u128/index.html); that effort is one of the motivations for this issue.
Another use-case here is to represent epoch microseconds.
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.
@odenix commented on GitHub (Aug 14, 2025):
> 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`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @bioball on GitHub (Jul 29, 2025).
The current
Intis 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?@odenix commented on GitHub (Aug 14, 2025):
What are the use cases, and how common are they?
Retrofitting
Intwould 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.@bioball commented on GitHub (Aug 14, 2025):
One use-case is to represent IPv6 addresses, which are 128-bit ints.
@odenix commented on GitHub (Aug 14, 2025):
Shouldn’t these be represented by an
Ipv6stdlib class in any case?@bioball commented on GitHub (Aug 14, 2025):
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.
@StefMa commented on GitHub (Aug 14, 2025):
The documentation of u128 is 🥇!
@odenix commented on GitHub (Aug 14, 2025):
FWIW, Java classes such as
java.time.Instantdon’t useBigIntegeranywhere (justlongandint).By the way, if Pkl’s
Intwas retrofitted to be arbitrarily sized, the Java code generator would need to generateBigInteger.