Skip to content

Let the smallest Int be written down - #928

Merged
onatozmenn merged 1 commit into
mainfrom
the-smallest-int-written-down
Aug 5, 2026
Merged

Let the smallest Int be written down#928
onatozmenn merged 1 commit into
mainfrom
the-smallest-int-written-down

Conversation

@onatozmenn

Copy link
Copy Markdown
Collaborator

-9223372036854775808 is one literal now.

The reason it could not be was real: negation is an operator everywhere else, so a digit run is decoded on its own and the digits of the smallest Int are one past the largest. A clause about the edge had to spell it 0 - 9223372036854775807 - 1.

The split is where it belongs. Whether the minus in front is the unary one is a question about the grammar, so the lexer hands the digits over as TokenKind::IntAtLimit and says nothing; the parser folds the pair and reports the digits standing alone. Everything larger is still the lexer's, still one message.

Int.min is still the better thing to write and is still what the message points at. agreement.rs carries both ends of the range.

`-9223372036854775808` is one literal now. It could not be before, and the
reason was real rather than an oversight: negation is an operator everywhere
else in this language, so a digit run is decoded on its own, and the digits of
the smallest `Int` are one past the largest. A clause about the edge had to
spell it `0 - 9223372036854775807 - 1`, and the message said so.

The split is where it belongs. Whether the minus in front of those digits is
the unary one is a question about the grammar, not about lexing, so the lexer
hands them over as `TokenKind::IntAtLimit` and says nothing. The parser folds
the pair, and reports the digits standing alone. Everything larger is still the
lexer's, still one message, still with a stand-in token so the parser has an
expression and nothing to add.

`Int.min` is still the better thing to write and is still what the message
points at. What changed is that the language can now say its own smallest
number in the notation it uses for every other one.

The two ends of the range are in `agreement.rs`, so neither engine gets to
negate a number that does not exist.
@onatozmenn
onatozmenn merged commit 812f7b9 into main Aug 5, 2026
8 checks passed
@onatozmenn
onatozmenn deleted the the-smallest-int-written-down branch August 5, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant