Design decisions

101. A range's ends are start and end; end is exclusive (2026-11-21)

(2..=4).hi was 5: every range is stored half-open, and .lo/.hi expose that, but hi reads as "the highest element". A cold review of agc077a flagged print(op.span.lo + 1, op.span.hi) as an off-by-one when it was correct, which is the trap in reverse. The accessors are renamed to r.start and r.end, with C++ end() and Python stop meaning: end is one past the last element for a..b and a..=b alike. The last element is r.last (the sequence getter, ?T, none when empty) and the count is r.len. .lo/.hi on ranges become errors with a type-directed cpl fix codemod; user record fields named lo/hi are untouched.

  • Why. Off-by-one is a P0 class; an accessor name must not suggest inclusive when it is exclusive. start/end is the familiar pair.
  • Reverse. Restore .lo/.hi as the range accessors and run the codemod backwards.
  • Status. Landed (checker, IR, interpreter, codegen, cpl fix type-directed codemod, LSP completion/hover/quick-fix, stdlib, ports, dreams, docs).