Varyonic programming is the design style encouraged by Vary's verification-first model. It treats program behaviour as something that should be explicit, typed, observable, and testable under mutation.
Varyonic programming means writing code so that its decisions are typed, its guarantees are explicit, its effects are isolated, and its behaviour is observable.
Varyonic covers both how code looks and how it is designed. This page starts with the shared code style; the guides below cover the design decisions.
All Vary code looks the same. A file you open in a stranger's project has the layout, the names and the spelling of common forms that yours has, so you read what it does instead of how it was typed. There are no settings to change this: not for indentation, not for import order, not for line breaks. A project cannot opt out.
| Part of the style | Who decides it |
|---|---|
| Layout | The formatter, vary fmt, which is not configurable. It sets four-space indentation, braces, one statement per line, blank lines between definitions, sorted imports, and how a long expression breaks |
| Names | The compiler (E003), and vary check (VCI015) for the rest. PascalCase for types, snake_case for everything else, and an uppercase-leading function name is a compile error |
| Canonical forms | vary fmt where the form is a spelling, and vary check rules (VCI001, VCI019, VCI020, VCI021) with a fix where the rewrite is mechanical. Examples: x is None rather than x == None, let x = e ?: return v for one optional unwrapped with one exit, let ... else for several, x.map(f) rather than an if that rebuilds the optional |
The same rules apply at every point where code changes:
| Where | What happens |
|---|---|
| Editor | The VS Code extension formats on save by default |
| Your terminal | vary fmt rewrites a file; vary fmt --check says whether it would; vary check --fix applies the mechanical rewrites |
vary var | A changed file that is not in vary fmt form is a blocking task (run_fmt), and a mechanical finding in a changed function blocks too. A run is not complete until both are clean, and there is no switch for it |
| An agent's Stop hook | vary var --hook stop keeps an agent from stopping while the work is not done |
| CI | vary fmt --check over the repository fails on any unformatted file |
If you disagree with a choice the formatter makes, open an issue against the formatter. There is no knob to turn, on purpose: the value is that nobody has to argue about it.
| Guide | Focus |
|---|---|
| Decisions and domain models | Observable results, typed domains, pure logic, and effect boundaries |
| Guarantees and resources | Errors, contracts, lifetimes, and finite decision spaces |
| Program architecture | Thin entry points, modules, and patterns to avoid |
| Scripting | A five-phase structure for scripts and a worked example |
| Page | Topic |
|---|---|
| Designing for mutation | How to apply these principles to raise mutation strength |
| Golden path | The mutation testing workflow |
| Oracles | Writing effective test assertions |
| Contracts in mutation | Contracts and mutation testing |
| Contracts | Contract syntax reference |
| HTTP services | Interfaces and service endpoints |
Program semantics should be explicit, typed, and observable. The language provides tools for this: domain modelling (data, enum), contracts (in, out, old), pure logic (pure def), structured error flows (Result, ?else), observable tests (observe), and mutation analysis (vary mutate). When these tools work together, you can see whether the program is correct by reading it, testing it, and mutating it.