Skip to content

TalorMemory safety the compiler proves, not the programmer spells out.

Static memory safety and no garbage collector, with less to write by hand: regions are inferred instead of annotated, a borrow needs no sigil written, and a call site carries nothing.

talor
use std.math.{PI};

variant Shape { Dot, Circle(f64), Rect { w: f64, h: f64 } }

fn area(s: Shape): f64 {
    match s {
        Shape.Dot => 0.0,
        Shape.Circle(r) => PI * r.powi(2),
        Shape.Rect { w, h } => w * h,
    }
}

fn main(): i32 {
    let shapes: Array<Shape> = [Shape.Circle(2.0), Shape.Rect { w: 3.0, h: 4.0 }, Shape.Dot];
    let total: f64 = 0.0;
    for s in shapes {
        total += area(s);
    }
    println(`total area: ${total}`);
    0
}

Why Talor ​

  • Ownership without the sigils. Parameters borrow by default, and the compiler infers from the body what a function does to the caller's values - a clause after the signature (edits dst, takes src) only states it out loud. Nothing is written at the call site, ever.
  • No references. There is no &, no &mut and no 'a: a place handed to a function that only reads it is a borrow of that place, and the region it stays valid in is inferred from the control flow rather than written at the signature.
  • A dot for everything. Shape.Circle(r), Point.of(1.0, 2.0), and io.STDIN after use std.io;: the same mark for enum cases, statics and module paths. :: does not exist.
  • Sum types and matching. A variant is a tagged union with a payload per case, read only through an exhaustive match. Option<T> and Result<T, E> are variants, which is why the language has no null and no exceptions.
  • Errors are values. Result<T, E> with ? to propagate, Option<T> for absence, and a panic only for what cannot continue.

Talor v0.1.0 - Released under the MIT OR Apache-2.0 license.