Sort Order

The guiding rule: wherever ordering is discretionary, the compiler enforces alphabetical order.

Where It Applies

ConstructOrder
Components of a product typeAlphabetical
Variants of a union typeAlphabetical
Multiple methods on a typeAlphabetical
Trait composition (Show = A & B)Alphabetical
Error union inside Result<T, E>Alphabetical
use statements at the top of a fileAlphabetical
Arms of a matchOrder of the union's variants (alphabetical)

Examples

A product type:

User = Birthday & Username

A union type:

Ord = Equal | Greater | Less

Multiple methods on the same type:

User.add    = (...) -> ...
User.export = (...) -> ...
User.remove = (...) -> ...

Inline error union:

File.read = (Path) -> Result<Bytes, IoError | NotFound | PermissionDenied> {
    ...
}

Match arms in variant order:

match ord {
    Equal   => ...,
    Greater => ...,
    Less    => ...,
}

Checking Without Compiling

just check path/to/file.ow

This runs only the sort-order check, with no codegen. Useful in pre-commit hooks or as a quick lint while editing.

Rationale

Ordering is a constant source of bikeshedding and diff noise. By forcing one canonical order, code reads the same way no matter who wrote it, and reordering is never a meaningful change.