Skip to content

std.sort

Accepted

Accepted as a V1 namespace skeleton. Sorting APIs are deferred.

std.sort owns sorting algorithms.

Expected Contents

  • sorting algorithms for mutable slices and collection views
  • stable and unstable sort variants when policy is designed
  • comparator-based sorting helpers when function/interface design supports them
  • order-contract-based sorting helpers

Future generic sort APIs are expected to require total ordering:

pub fn sort(comptime T: Ord(T), items: []T) void

The exact API is deferred. Sorting APIs should require Ord(T), not merely PartialOrd(T), because unordered operands make result policy non-obvious.

V1 Boundary

V1 does not accept a public std.sort.sort function, stable or unstable sort variants, comparator-based sorting, or sort allocation policy. Full sorting design is deferred to CEP-0054: Standard Utility APIs.