SAFE
Safe code cannot read freed memory, overrun a buffer, dereference null, or race on shared data. Undefined behaviour lives only in unsafe.
Latest binarytrees over arenas runs in a quarter of C's time, in 20 MiB. Read the report →
A systems language
C's reach. Go's feel and concurrency. Rust's safety without lifetimes. Deterministic cleanup. No tracing garbage collector.
$ cat hello.dx fn main() { print("hello, world") } $ deox build hello.dx $ ./hello hello, world $ █
Every language it borrows from is missing something. deoxlang picks up the pieces. Who is it for, and who should wait?
Safe code cannot read freed memory, overrun a buffer, dereference null, or race on shared data. Undefined behaviour lives only in unsafe.
Native code through C or LLVM. No tracing collector, no hidden allocation. Arenas when you want a whole tree gone in one reset.
Ownership with own, ref and weak, and deterministic destruction. Nothing kept alive waiting for a collector.
Go's model: spawn, channels and select. A task is cheap, and one that waits on a channel, timer or socket costs nothing.
Result and Option, postfix ?, or, wrap, defer and errdefer. A Result can't be dropped on the floor.
import "zlib.h" reads the header at build time. Call libc, hand qsort a comparator written in deox.
build test cover fmt doc prof lsp, one binary. One formatter, no options. Errors that tell you the edit that fixes them.
Spelled-out over sigils. A C or Go programmer writes useful code on day one, and so does a model pattern-matching to Rust or Go.
Braces and newlines, no semicolons, name: Type everywhere.
/// What reading a number can fail with.
enum NumError {
Empty
BadDigit(text: string)
TooLarge(text: string)
}
fn number(s: string) -> Result[int, NumError] {
if s.len() == 0 { return Err(Empty) }
mut n = 0
for i in 0..s.len() {
if s[i] < '0' || s[i] > '9' { return Err(BadDigit(text: s.copy())) }
n = n * 10 + int(s[i] - '0')
if n > 65535 { return Err(TooLarge(text: s.copy())) }
}
return Ok(n)
}
// wrap attaches a sentence and boxes, ? propagates.
fn report(name: string, text: string) -> Result[string, Error] {
defer print(f" {name}: done")
errdefer print(f" {name}: giving up")
let cfg = load(text).wrap(f"loading {name}")?
// or with a value: the default.
let retries = cfg.retries or 3
return Ok(f"{cfg.host}:{cfg.port}, {retries} retries")
}
import "sync"
struct Job {
id: int
n: int
}
// A worker receives jobs until the channel is closed.
fn worker(jobs: own chan Job, results: own chan (int, int), wg: own sync.WaitGroup) {
for job in jobs {
results <- (job.id, fib(job.n))
}
wg.done()
}
fn main() {
let jobs = chan Job(8) // buffered
let results = chan (int, int)(8)
let wg = sync.wait_group()
for _ in 0..3 {
wg.add(1)
spawn worker(jobs.copy(), results.copy(), wg.copy())
}
for id in 0..8 {
jobs <- Job{ id: id, n: 20 + id }
}
close(jobs)
wg.wait()
close(results)
}
struct Point {
x: f64
y: f64
}
// A borrowed receiver reads, a mut receiver changes the caller's
// value, an own receiver consumes it.
fn (p: Point) norm() -> f64 { return math.sqrt(p.x * p.x + p.y * p.y) }
fn (p: mut Point) scale(k: f64) {
p.x *= k
p.y *= k
}
/// Structural: a type with these methods satisfies it, claimed or not.
interface Shape {
fn area() -> f64
fn name() -> string
}
// An enum is a closed set of shapes in one type; a match names them all.
enum Figure {
Circle(r: f64)
Rect(w: f64, h: f64)
Empty
}
fn (f: Figure) area() -> f64 {
return match f {
Circle(r) => 3.14159 * r * r
Rect(w, h) => w * h
Empty => 0.0
}
}
binarytrees, run time in ms, best of 5. 2026-11-28, AMD Ryzen AI MAX+ 395, Arch Linux. Lower is better.
One benchmark on one machine; the full method and the other programs (wordcount, nbody, mandelbrot, hashmap…) are in bench/RESULTS.md.
A standard library written in deoxlang wherever it can be.
Real programs in examples/, each with a selftest that runs in the suite.
1 Install the latest release. The script verifies the checksum and installs to ~/.local/bin.
sh install.sh
2 Write hello.dx, then build it.
deox build hello.dx && ./hello
Linux and macOS, amd64 and arm64. deox compiles through C, so the machine needs cc; -backend=llvm wants clang 15 or later. install.sh is at the root of the repository.