All languages

Odin language

A data-oriented systems language with distinct typing: manual memory through explicit allocators, no classes or inheritance, built-in SOA and SIMD types, and a foreign system that binds C libraries directly.

Overview

Odin is an imperative, systems language positioned as an alternative to C: explicit allocators instead of a garbage collector, and deliberately no classes, methods, or exceptions. It exists so that high-performance code reads as the data it transforms, while the whole specification stays small enough for one person to memorize.

Code

import "core:fmt"
main :: proc() {
    year := 2016                      // untyped literal; defaults to int
    mass: u32                         // declared and unset: zero value is 0
    fmt.println(year + 10, mass + 70) // operators consume: 2026 70
}
Four fragments, one per slot. Literals then operators; composites whose length, fields and membership are all checked; procedures as the unit, specialized by parametric polymorphism and distinguished by multiple results; then the data-oriented idiom — an arena behind the implicit context, with #soa layout.

Distinctive traits

  • Memory is manual: new, make and delete take an allocator, and an arena frees a whole subsystem in one call.
  • Implicit context: allocator, logger and assert handler travel with every call, so third-party code can be redirected without editing it.
  • Distinct typing: distinct int is a new type and every width change is explicit, so no value widens silently.
  • Layout is a language feature: #soa transposes a struct array into per-field arrays, and #simd[N]T vectors map onto hardware registers.
  • Data and code stay separate — no classes, methods or exceptions; errors are ordinary return values forwarded with or_return.
  • Also built in: tagged unions with exhaustive type switches, bit sets for flag sets, and a foreign block binding C libraries.

Status

Active but pre-1.0: the compiler is written in C++ and emits native code through LLVM (per the FAQ), shipping dated dev- builds with no 1.0 release. Compiler and libraries use the zlib licence.

History

In late July 2016 Ginger Bill began Odin out of frustration with C++, first as a Pascal clone before moving to C-like syntax; the repository went public on 23 November 2016. The documented influences are Pascal, C, Go, Oberon-2, Newsqueak and GLSL.

Sources & references