This repository was archived by the owner on Sep 24, 2026. It is now read-only.
Rework semantics: explicit empty ranges and honest partial-order support - #13
Merged
Merged
Conversation
The crate previously returned an arbitrary, representation-dependent answer for empty ranges, and PR10's `partial_rcmp -> Option<RangeOrdering>` collapsed a poset position into a single ambiguous verdict, conflating "incomparable with the whole range" with "comparable with one bound, incomparable with the other". Both issues are addressed with a single core idea: represent a value's position as the *pair* of its relationships to the lower and upper bounds. - Add `BoundOrdering` (Within / Outside / Incomparable) and `RangePosition` (the lower/upper pair), with `RangePosition::ordering()` collapsing to a simple verdict when both bounds are comparable, and `is_inside()`. - `RangeOrdering` gains an `Empty` variant. `rcmp` (Ord) now detects empty ranges from their bounds and reports `Empty` instead of a bogus Below/Above, and never falsely reports `Inside` for an empty range. - Introduce `PartialRangeOrd::partial_rcmp -> RangePosition` for `PartialOrd` types, preserving per-bound information instead of losing it in an `Option`. - Tests: convert the partial suite to the new type, complete the previously empty stubs, and add the comparable-to-one-bound-only cases that the old design lost. Fix the README/code name drift (`RangeComparable`/`range_cmp`). This is a breaking change; bump to 0.3.0. https://claude.ai/code/session_01CTKxSkrLTyauoiGSFo2dVS
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 crate previously returned an arbitrary, representation-dependent answer
for empty ranges, and PR10's
partial_rcmp -> Option<RangeOrdering>collapseda poset position into a single ambiguous verdict, conflating "incomparable
with the whole range" with "comparable with one bound, incomparable with the
other".
Both issues are addressed with a single core idea: represent a value's
position as the pair of its relationships to the lower and upper bounds.
BoundOrdering(Within / Outside / Incomparable) andRangePosition(the lower/upper pair), with
RangePosition::ordering()collapsing to asimple verdict when both bounds are comparable, and
is_inside().RangeOrderinggains anEmptyvariant.rcmp(Ord) now detects emptyranges from their bounds and reports
Emptyinstead of a bogusBelow/Above, and never falsely reports
Insidefor an empty range.PartialRangeOrd::partial_rcmp -> RangePositionforPartialOrdtypes, preserving per-bound information instead of losing it in an
Option.empty stubs, and add the comparable-to-one-bound-only cases that the old
design lost. Fix the README/code name drift (
RangeComparable/range_cmp).This is a breaking change; bump to 0.3.0.
https://claude.ai/code/session_01CTKxSkrLTyauoiGSFo2dVS