string: Ord was promised in the clause and never written #233

Manually merged
mdoorn merged 1 commit from feat/233-string-ord-was-promised-in-the-clause-and-neve into master 2026-09-18 08:30:00 +02:00
Owner

string: Ord was promised in the clause and never written

Touches 9 files: plan.md, problem_composed_but_unimplemented.md, problems.md, src/rust/crates/ck_driver/tests/capability/ledger.rs, tests/capability/string_ord_is_composed_but_never_implemented.cktest, tests/capability/string_ord_is_reflexive_on_its_weak_glyphs.cktest and 3 more.

string: `Ord` was promised in the clause and never written Touches 9 files: `plan.md`, `problem_composed_but_unimplemented.md`, `problems.md`, `src/rust/crates/ck_driver/tests/capability/ledger.rs`, `tests/capability/string_ord_is_composed_but_never_implemented.cktest`, `tests/capability/string_ord_is_reflexive_on_its_weak_glyphs.cktest` and 3 more.
lnguyen approved these changes 2026-09-18 03:30:00 +02:00
lnguyen left a comment

Good. Small enough to read in one sitting, and src/rust/crates/ck_driver/tests/capability/ledger.rs is easier to follow than it was.

Good. Small enough to read in one sitting, and `src/rust/crates/ck_driver/tests/capability/ledger.rs` is easier to follow than it was.
@ -709,0 +737,4 @@
// read would then stop where `list_size_field` already stops. Three walls, each
// one an existing cell. What made `Ord` different is that its four methods take
// no size parameter at all.
pub(crate) const BROKEN_CELL_COUNT: usize = 77;
Owner

Where does the number beside BROKEN_CELL_COUNT come from? It reads as measured rather than chosen, and nothing on the line says which, at src/rust/crates/ck_driver/tests/capability/ledger.rs:740.

Where does the number beside `BROKEN_CELL_COUNT` come from? It reads as measured rather than chosen, and nothing on the line says which, at src/rust/crates/ck_driver/tests/capability/ledger.rs:740.
Author
Owner

Measured. It is a named constant in src/rust/crates/ck_driver/tests/capability/ledger.rs now, with a line saying how.

Measured. It is a named constant in `src/rust/crates/ck_driver/tests/capability/ledger.rs` now, with a line saying how.
`newtype String<size: Size> … composes Sized<String, size>, Equals, Ord, Show,
Concat` names five traits. Four had impls. `a < b` on two strings was E0728, the
ordinary no-such-trait-method refusal, and the cell that pinned it had been
telling us the fix for two days: "lexicographic order is writable today …
nothing is blocked; the block was never written." It was right. Zero Rust
changed.

`str_cmp` is the `Equals<String<n>>` walk a hundred lines up in `Prelude.ck`
with a three-way verdict instead of a two-way one. `Bytes::at` over the common
prefix while `d == 0`, where `d = ba::Int - bb::Int` is in [-255, 255] and is
zero exactly when the bytes match, so the loop needs no branch inside it and
stops at the first difference. Ties on the prefix fall through to `la - lb`, so
the shorter string orders first. The cursor is a `let mut` pair, not the scratch
region `Bytes::byte_eq` allocates for its counter (that unit predates the
register law), so rule M1's `Prelude.ck` row stays at 13.

THE FIXED CELL CANNOT DISCRIMINATE, so three landed beside it. `"ab" < "ac"` is
equal-length and differs in the last byte: an implementation that never read a
length passes it, and `le`, `gt` and `ge` were four lines of stdlib nothing
executed. `string_ord_orders_a_prefix_before_its_extension` pins the `la - lb`
fallthrough both ways, `string_ord_weighs_a_byte_before_a_length` pins that
`"b" > "ab"` so a length never votes once a byte differs, and
`string_ord_is_reflexive_on_its_weak_glyphs` runs all four glyphs on equal
operands, the one verdict the strict/weak split can disagree about. Writing the
third found a language fact worth the trip: `a && b && c` is E0146, no
same-precedence chaining, so it parenthesises in pairs.

WHAT DID NOT MOVE, and now has a reason instead of an assumption. Wave 0 was
read end to end by five investigations that had to cite source. It is five
cells, not nine. Both `size_of` cells left for Wave 5: `= size` reads a
head-bound parameter as a value and `resolve_impl_bodies` pushes exactly one
frame per method, the method's parameters, so no scope binds it; the other two
routes stop at `impl_method_signature_size_param` and `list_size_field`. No impl
in 43 stdlib units reads a head binder as a value. `Ord` was landable precisely
because its methods take no size parameter. `composes_error_does_not_accept_its_
required_hint` left for behind Wave 1: its one-line-looking fix would paint the
cell green over a value at offset 0 of a frame whose ABI row has zero slots, and
the fixture is the exact shape that hides it. `return` and `s[i]` stay in Wave 0
and are slices, not commits. "One wall, two spellings" is refuted: two refusal
sites, two stages, two fixes, and the gate keys on the variant, which is why
they looked like one.

`problems.md` is rewritten rather than appended to. It had grown five paragraphs
of self-correction above the first fact a reader needed. The waves now come
first, Wave 0's real cost is a table, and every claim the file has lost sits
dated in one section at the end.

RATCHETS: `CELL_COUNT` 475 -> 478, `BROKEN_CELL_COUNT` 78 -> 77.
`UNMARKED_CELL_COUNT` holds at 0. `Grammar.ckx`'s M21 measurement moves 210 ->
212 because `Prelude.ck` gained two top-level declarations; that table is
machine-produced and the harness printed the line to write.

GATES: `./scripts/test.sh` four legs ALL GREEN (unit 1382, corpus 107 apps,
capability 478 cells, docs 42 expectations). Full sweep 1639 passed, 0 failed,
1 ignored across 75 binaries. `cargo fmt` 0 diffs. `cargo clippy --workspace
--all-targets -D warnings` reports 2 errors, both PRE-EXISTING and confirmed on
the stashed tree: `absurd_extreme_comparisons` at `capability/main.rs:378,388`,
because `UNMARKED_CELL_COUNT` reached its target of 0 and `<= 0` / `>= 0` on a
`usize` became absurd. Not caused here, not absorbed here.
mdoorn manually merged commit 9f3baf3945 into master 2026-09-18 08:30:00 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
northgale/cklang-bootstrap!233
No description provided.