For people and AI writing code together
Safe. Fast. Easy to read.
A programming language for software you can rely on.
Software you can rely on, whether a person writes it, a model, or both together. The compiler checks for the mistakes that are easy to miss in review before the program runs, and says where its checks stop.
Nikaia is a programming language for applications: backends, web services, and software that has to be fast and correct at the same time. That is its home.
It also reaches from small scripts down to the hardware, though those areas are still young and come with rough edges.
Nikaia is built around an ambitious goal: safety, performance, and readability without having to trade one for another.
Good wins.
People and AI
When people and AI write code together
More and more code is written with a model, or by an agent that changes a program on its own. Such code reads well, and its mistakes are often the kind review finds hardest: two tasks that change the same value, an error that nobody handles, a call outside what a function expects. Nikaia's compiler looks for these before the program runs, and where it cannot tell what a call touches, as in a Rust crate or a C library, it says so instead of refusing.
Its messages say what is wrong and what to write instead, so an agent can read the error, change the code and build again, and the person reviews a program the compiler has already checked. No model has Nikaia in its training data yet: generating it means putting the specification in the model's context. The compiler is pre-alpha. The longer argument →
Very safe
Catch mistakes before they become failures. Nikaia checks how tasks interact: two tasks that would change the same value at once, a task nobody waits for, an error a task throws that nobody handles. A memory budget for every task is specified and not built yet. It checks how errors are handled and whether parts of your program keep their promises, at compile time wherever it can, and shows you where its checks stop. How it works — and where the limits are ↓
Very fast
Fast as lightning. Programs written in Nikaia run faster than most of what you know, in the league of the fastest languages there are. The measurements ↓
Easy to understand
Nikaia code is short and reads like a plain script. You write what should happen, and Nikaia works out the technical details other fast languages make you spell out. When something is wrong, it tells you in plain words what to change. What it looks like ↓
Made for good
Software that fails less hurts fewer people. Programs that do more with less hardware use less energy. And a language anyone can read lets more people build. That is why Nikaia exists. Why it exists ↓
Very safe
Catch mistakes before they become failures.
Many bugs follow patterns. Nikaia checks for those patterns before they reach your users, and says where it cannot.
Conflicting actions
Two tasks change the same value at once. One update overwrites the other.
overlap {
balance = balance + 50
balance = balance - 30
}error[NK2104]: These two branches can't run at the same time.
note: Both change `balance`.Tasks that get stuck
Tasks wait for each other forever, or one holds up everyone.
a.update fn(mut acc) {
acc.balance -= 30
time::sleep(5.millis())
}error: `time::sleep` can pause, but you're holding a lock here.A memory budget for every task
A task that uses up its memory ends alone, and the rest of the program runs on. Every task gets a memory budget of its own, as in Erlang and Elixir.
Decided and specified, not built yet: today a task can still take memory from the whole program.
Read more → Refused when builtErrors that go unhandled
Something fails and nothing deals with it.
fn load() -> String {
return fs::read_to_string("config.txt", fs::Root::Anywhere)
}error: This function can fail, because `fs::read_to_string` can fail.Broken promises
A part of the program is called outside what it was told to expect.
fn percent(n: int) -> int {
assert(n >= 0 && n <= 100)
return n
}
percent(140)error: This call breaks `percent`'s precondition `n >= 0 && n <= 100` every time it is reached.Very fast
Fast, and counted.
Programs written in Nikaia run in the league of the fastest languages there are. This is where that comes from, and how it is measured.
1BRC study: the Nikaia compiler vs. human vs. AI
Nikaia is pre-alpha, and it need not hide: on the One Billion Row Challenge at the baseline CPU level its safe program already does less work than the fastest Rust a person wrote, and mispredicts a third as many branches.
Read more → One lineOne core or all of them
Whether your code may run on several cores is one line. The code does not change.
[build]
user-parallelism = "no" # or "yes"No garbage collector, no free
Memory is released at a point you can see in the code, without collector pauses.
You write no free and no lifetimes. The compiler works out when memory can be released, and the release is a point you can see.
Checks that are proved are dropped
An index or overflow check that cannot fail is not written, where you ask for it.
[build]
optimization = "remove-bounds-checks:on,remove-overflow-checks:on"Easy to understand
Short code that reads like a script.
You write what should happen, and Nikaia works out the technical details other fast languages make you spell out. When something is wrong, it tells you in plain words what to change.
Code that waits needs no marking
The compiler finds where a function pauses, so a call that waits is written like any other, and its callers stay as they are.
let user = async db::load_user(id)
let rights = async db::load_rights(id)
let prefs = cache::load_prefs(id)
render(user, rights, prefs) // waits for bothThe async form is the design being built (#983); today the same is written with overlap.
Readable errors
An error says what you wrote, why it cannot work and what to write instead.
error[NK1139]: You're changing `count`, but it wasn't declared as mutable.
help: Add `mut` where it's declared: `let mut count`.Formats are part of the language
Describe a format as a grammar and the compiler builds the parser.
grammar Calc {
entry rule expr -> i64 =
head:term tail:add_tail* { … }
rule add_tail -> i64 =
"+" t:term { t }
| "-" t:term { -t }
}Made for good
Why Nikaia exists.
Software that fails less hurts fewer people. Programs that do more with less hardware use less energy. And a language anyone can read lets more people build.
Built in the open
The compiler is moving into Nikaia itself, and every design decision is argued in a public record.
Each decision is argued in an ADR and accepted by a human. The compiler is being rewritten, part by part, in the language it compiles.
Read more → Honest statusPre-alpha: what to expect
The compiler builds real programs today. A package registry, formatter and language server do not exist yet.
A calculator, a JSON parser, a log analyser, a small HTTP server and the One Billion Row Challenge build today.
Read more → The manifestoWhy Nikaia exists
Good and fast are not opposites. Nikaia is named for Nika, and nik means good.
“Good wins.” Not over anyone: it denies that good and fast are opposites, and that being decent to the person writing the code has to be paid for at runtime.
Read more →Where Nikaia fits
Easy languages
Python, JavaScript
Quick to write in. The programs are slower and need more memory, and some mistakes only show up in production, under load, at night.
Fast languages
C++, Rust
Fast programs. In exchange, much of each program tells the compiler how memory, waiting and sharing should work.
Nikaia
fast and safe
A compiler that sees the whole program can work much of that out itself. You write plain code and Nikaia turns it into optimised machine code. Nikaia checks your program, and Rust's compiler checks memory safety again.
Where to go next
Getting started
Install the compiler and run your first project.
A tour of the syntax
The language on one page, for readers of other languages.
Contracts
What the compiler proves about an assert, with its output.
Manifesto
Why the project exists, and the reasoning behind it.
Specification
The full rules, from variables to the concurrency model.
Decisions
Every design decision, with the evidence that settled it.
GitHub
The source, the issues, and "this cannot work because…" arguments.