You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found in the container survey prompted by #936. grep -rn 'fn .*sort' lib/std/ finds nothing in the stdlib proper; the only sort in the tree is tool_glob_sort in lib/std/build.w (an insertion sort over strings, O(n²), fine for globbing). User code and the compiler's own tooling have no Vec.sort() / sort_by(cmp) to reach for, so the alternative is hand-rolling one (or BTreeMap, #937).
Ask
Vec[T: Ord].sort() and Vec[T].sort_by(fn(&T, &T) -> i32) in lib/std/collections.w — an in-place, deterministic algorithm (a stable merge sort or introsort; determinism matters for fixpoint-facing tooling). Element moves go through the D27 slot machinery so Drop-class elements are never bit-copied; the drop audit covers it. Fixture: ints, strings, structs by key, stability check for sort_by.
Ruling (Eric, 2026-09-01): not a native rewrite. The stdlib's algorithms and containers come from three C corpora migrated whole with with migrate — c-algorithms, TommyDS, STC (plus a surgical M*LIB B+ tree port) — and the With stdlib is a facade that selects engines from them. The model is "migrate the library whole, facade selectively": we never migrate pieces, the un-facaded code stays as migration coverage, alternate engines for benchmarks, and a corpus for migrator bugs.
For sort specifically: Vec.sort / sort_by / binary_search / lower_bound facade STC's algorithm layer (with c-algorithms' sorted array and heap as the classic alternates). STC's macro/template instantiation is the deliberate migrator-hardening campaign that comes with it.
Plan: docs/stdlib_sourcing_plan.md (landing with the next docs commit). This issue stays open as the facade deliverable for sorting/searching; it closes when Vec.sort is a facade over the migrated corpus with complexity fixtures.
Activity
ehartford commentedon Sep 2, 2026
Ruling (Eric, 2026-09-01): not a native rewrite. The stdlib's algorithms and containers come from three C corpora migrated whole with
with migrate— c-algorithms, TommyDS, STC (plus a surgical M*LIB B+ tree port) — and the With stdlib is a facade that selects engines from them. The model is "migrate the library whole, facade selectively": we never migrate pieces, the un-facaded code stays as migration coverage, alternate engines for benchmarks, and a corpus for migrator bugs.For sort specifically:
Vec.sort/sort_by/binary_search/lower_boundfacade STC's algorithm layer (with c-algorithms' sorted array and heap as the classic alternates). STC's macro/template instantiation is the deliberate migrator-hardening campaign that comes with it.Plan: docs/stdlib_sourcing_plan.md (landing with the next docs commit). This issue stays open as the facade deliverable for sorting/searching; it closes when
Vec.sortis a facade over the migrated corpus with complexity fixtures.docs: stdlib sourcing plan — three corpora migrated whole, facades ch…
docs: refresh the lib/std plan against the tree and the sourcing plan…
Remove the hand-written Vec.sort and Vec.swap
Remove the hand-written Vec.sort and Vec.swap (#2280)
Phase 3 facades over the STC engines (D148): PriorityQueue, OrderedSe…