Who owns a value
Every value has one owner. Loans and moves are checked. Cleanup runs exactly once, at a visible point.
A programming language · v0.0.1 release candidate
Fortis is a statically checked, compiled language for software written mostly by AI agents. People can read, review and trust it because every decision is written in the source. Ownership, changes, failures and effects are explicit.
Hover or focus a note, line or pin to explore. Click or tap to pin the focus; repeat, click elsewhere or press Escape to clear. Go to the notes.
import fortis.host { Host }export error Empty { code: "demo.empty"}123pure try func mean(readings: ListView[Int<0..1000>]) Int { let n = readings.count() if n <= 0 { fail Empty() } let mut total = 0 for r in readings {4 total = Int.add(total, r) or fail } return total / n}export func main(args: List[String]) Void {7 let caps = Host.capabilities()5 let mut readings: List[Int<0..1000>] = List.of(12, 30, 18)5 editable readings.push(40)6 let m = mean(readings) catch e {6 report e6 recover 0 }7 caps.console.print("mean of ${readings.count()} readings: ${m}")}
mean of 4 readings: 25
Same output on the interpreter, the VM and native
pure rules out effects such as I/O and clock access. The checker verifies it.
try declares that mean can fail. Its caller must handle the outcome.
Int<0..1000> carries a range. ListView gives read-only access.
Int.add checks overflow. or fail passes the failure to the caller.
mut declares a mutable binding. editable marks the call that changes the list.
catch handles the failure, reports it and recovers with 0.
main obtains capabilities from the host. Printing uses the console capability.
Example source. This example is checked and run on all three backends when the documentation builds.
Start with a checkout of the Fortis repository. You need Python 3 and a Rust toolchain with cargo. Run these commands from the repository root.
The reference toolchain uses Python. Build the production compiler with Cargo.
cargo build --release --manifest-path compiler/Cargo.tomlCopy the complete program above and save it as mean.ft in the repository root.
The copy includes only the source, without line numbers or annotations.
Check the source, then run it on the reference interpreter.
bin/fortis check mean.ft
bin/fortis run mean.ftmean of 4 readings: 25
Same output on the interpreter, the VM and native
v0.0.1 release candidate. Language 1.0 is still being built and is not released.
Fortis puts ownership, failure handling and authority in the file or diff you are reading.
Every value has one owner. Loans and moves are checked. Cleanup runs exactly once, at a visible point.
A call that can fail says so. Each failure must be handled, reported or passed up. The compiler checks this.
The checker verifies pure. Output needs a console capability obtained from the host.
The interpreter, development VM and native backend must agree on program output. The test suite checks that agreement.
The reference for what a program means.
bin/fortis run mean.ftRun with the production compiler's VM.
compiler/target/release/fortisc vm mean.ftCompile through a safe Rust crate.
bin/fortis build mean.ft --out meanThe current status is v0.0.1 release candidate. Each release is a subset with its own documentation and release checks. Performance is judged at v1.0.