About

Varyonic programming

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 code looks the same

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 styleWho decides it
LayoutThe 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
NamesThe 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 formsvary 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:

WhereWhat happens
EditorThe VS Code extension formats on save by default
Your terminalvary fmt rewrites a file; vary fmt --check says whether it would; vary check --fix applies the mechanical rewrites
vary varA 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 hookvary var --hook stop keeps an agent from stopping while the work is not done
CIvary 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.

Design guides

GuideFocus
Decisions and domain modelsObservable results, typed domains, pure logic, and effect boundaries
Guarantees and resourcesErrors, contracts, lifetimes, and finite decision spaces
Program architectureThin entry points, modules, and patterns to avoid
ScriptingA five-phase structure for scripts and a worked example

Further reading

PageTopic
Designing for mutationHow to apply these principles to raise mutation strength
Golden pathThe mutation testing workflow
OraclesWriting effective test assertions
Contracts in mutationContracts and mutation testing
ContractsContract syntax reference
HTTP servicesInterfaces and service endpoints

Summary

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.

Language design choices →