Document hex literal range behavior on signed types - #595
Merged
Conversation
✅ Deploy Preview for pony-tutorial ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The tutorial's literals page mentioned hex and binary as notation options but never explained the prefixes or what happens when a hex value exceeds a signed type's range. A user hit this with `0x80006000` on I32 (ponylang/ponyc#6011). Adds a "Hex and Binary Literals" subsection that introduces the `0x` and `0b` prefixes, explains that hex and binary literals are always positive values, and shows how to negate the positive form when you need a negative hex constant on a signed type.
SeanTAllen
force-pushed
the
document-hex-signed-range
branch
from
September 7, 2026 14:58
4678e2d to
1175dd3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tutorial's literals page didn't mention what happens when a hex literal exceeds a signed type's positive range. A user hit this with
0x80006000on I32 and filed ponylang/ponyc#6011.Adds a short subsection after the existing hex/binary example explaining that integer literals are positive values, the compiler rejects them when they exceed the type's maximum, and you negate the positive form to get a negative hex value.