Skip to content

Is there an effective way to represent a 64-bit Unsigned Integer in Pkl? #481

Answered by HT154
xerotolerance asked this question in Q&A
Discussion options

You must be logged in to vote

Because all of Pkl's (U)Int?? types are range-constrained type aliases of Int, they're all stored signed (and 64 bits) under the hood. Supporting UInt64 (or even other larger integers) is definitely a current, known shortcoming of the language and I'd encourage you to file an issue about it!

Similar needs have come up in the past. pkl.experimental.net needs a UInt128 implementation to work with IPv6 addresses and it uses a class composed of 4 UInts to do so: https://github.com/apple/pkl-pantry/blob/main/packages/pkl.experimental.net/u128.pkl

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@xerotolerance
Comment options

Answer selected by xerotolerance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants