Skip to content
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
adriendellagaspera merged 1 commit into
masterfrom
claude/crate-concept-review-arI68
May 31, 2026
Merged

adriendellagaspera merged 1 commit into
masterfrom
claude/crate-concept-review-arI68

Conversation

@adriendellagaspera

Copy link
Copy Markdown
Member

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

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
@adriendellagaspera
adriendellagaspera merged commit 5570da5 into master May 31, 2026
2 checks passed
@adriendellagaspera
adriendellagaspera deleted the claude/crate-concept-review-arI68 branch May 31, 2026 22:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants