Skip to content

MiloA memory-safe systems language that guides you to correct, readable programs.

Contracts and formal verification are built into the language to help you ship correct code with confidence.

Milo
sh
curl -fsSL https://milo-language.github.io/milo/install.sh | sh
milo
fn main() {
    let name = "world"
    print($"hello, {name}")
}
milo
fn clamp(x: i64, lo: i64, hi: i64): i64 {
    if x < lo { return lo }
    if x > hi { return hi }
    return x
}
milo
fn clamp(x: i64, lo: i64, hi: i64): i64
    requires lo <= hi                       // the caller's obligation
    ensures result >= lo && result <= hi    // proven, for every input that meets it
{
    if x < lo { return lo }
    if x > hi { return hi }
    return x
}
milo
from "std/math" import { Math }

struct Point {
    x: f64,
    y: f64,
}

impl Point {
    fn dist(self: &Self): f64 {
        return Math.sqrt(self.x * self.x + self.y * self.y)
    }
}

fn main() {
    let p = Point { x: 3.0, y: 4.0 }
    print($"{p.dist()}")   // 5
}
milo
fn main() {
    let name = "milo"
    let greeting = name   // `name` moves here. It is no longer yours

    print(greeting)       // "milo"
    print(name)           // error: use of moved variable 'name'
}
milo
from "std/fetch" import { fetch }
from "std/runtime" import { Promise }

fn main() {
    let a = Promise<i32>.run(() => fetch("https://example.com")!.status)
    let b = Promise<i32>.run(() => fetch("https://httpbin.org/get")!.status)

    print($"{a.await()!} {b.await()!}")   // 200 200
}

Built with Milo

Milo is young - still a puppy 🐶 - but we have built a lot with it already! We dogfood the language by writing a variety of real-world programs to prove it works. This allows for maximum contact with reality, and rapid iteration on things that need improvement. It's ready for you to try today, feedback is appreciated.

Take Milo for a walk