Jump to content

Odin (programming language)

From Wikipedia, the free encyclopedia
Odin
ParadigmImperative, data-oriented, procedural
Designed byBill Hall
DeveloperThe Odin Community
First appearedJuly 2016 (2016-07)
Stable release
dev-2026-02 / February 4, 2026; 7 days ago (2026-02-04)
Typing disciplineStatic, strong, inferred
OSWindows, macOS, Linux, FreeBSD
Licensezlib License
Filename extensions.odin
Websiteodin-lang.org
Major implementations
Odin Compiler (LLVM-based)
Influenced by
Pascal, C, Go, Oberon-2, Newsqueak, GLSL[1]

Odin is a general-purpose, statically typed, compiled systems programming language designed by Bill Hall. It was created to serve as an alternative to C using data-oriented programming and a modern type system.

The language avoids object-oriented concepts such as classes and inheritance. Instead it offers features such as structs, data composition, and a custom context system.[2] It is a general purpose language with systems-level performance, so it can be used in game development and computer graphics. It is used as the primary language for the software developed by JangaFX.[3]

History

[edit]

Development of Odin began in July, 2016, by Bill Hall (often referred to online as "Ginger Bill").[1] Hall began the project due to frustration with C++ and a desire for a language that offered the low-level capabilities of C with modern quality-of-life improvements, strict type safety, and better memory control.

The language has been developed as an open-source project, hosted on GitHub, with contributions from the community. It is currently in active development, with frequent releases aimed at stabilising a specification before reaching version 1.0.

Design and philosophy

[edit]

Odin is designed with a focus on simplicity,[4] high performance, and modern systems programming needs. While it shares the goal of being a system-level language like C, it features distinct syntax and behavior compared to C, adopting a Pascal-style declaration syntax and strict type separation.[5] To support high-performance graphics and game development, the language includes a rich built-in set of types for mathematics, including vectors, matrices, and quaternions, as well as native support for endian-specific types.[5]

Data-oriented programming

[edit]

A core pillar of Odin's philosophy is data-oriented programming, also known as data-oriented design (DOD). The language provides native features to manipulate memory layouts efficiently, catering to modern CPU cache architectures. This includes built-in support for struct of arrays (SoA) data structures. While many languages require manual implementation of SoA layouts, Odin provides specific syntax, such as `#soa` slices and arrays, to automatically transform data structures. This allows developers to switch between Array of Structures (AoS) and SoA without significant refactoring of the codebase.[6]

Memory management

[edit]

Odin relies on manual memory management rather than garbage collection. To manage resources safely, the language utilizes a `defer` statement to ensure cleanup code runs at the end of a scope.

Implicit context

[edit]

A distinctive feature of Odin is the "implicit context system." According to language creator Bill Hall, "in each scope, there is an implicit value named `context`" which "is local to each scope and is implicitly passed by pointer to any procedure call in that scope."[7] Hall states that "the main purpose of the implicit context system is for the ability to intercept third-party code and libraries and modify their functionality," such as "modifying how a library allocates something or logs something."[7] The language documentation notes that this allows the system to define "the allocator, the logger, and the error handler" for a specific scope without explicitly passing them as parameters.[2]

Type system and features

[edit]

The language uses a strict, statically typed system. It supports "ad hoc parametric polymorphism" (generics), allowing for reusable code structures without the complexity of traditional C++ templates or object-oriented inheritance.[5]

Odin supports multiple return values from procedures. This feature facilitates the language's primary method of error handling: rather than using exceptions, Odin relies on error handling through multiple returns, where a procedure returns a value alongside an error code or a boolean success flag.[5] The type system also enforces "distinct types," meaning a named type defined from an existing type (e.g., `distinct int`) cannot be used interchangeably with the original type without an explicit cast, preventing logic errors.[2]

Syntax

[edit]

Odin's syntax uses curly braces for scoping but adopts a procedural declaration style.

Hello World

[edit]
package main

import "core:fmt"

main :: proc() {
    fmt.println("Hello, World!")
}

Pointers

[edit]

Odin uses `^` for pointer types and a postfix `^` for dereferencing:

p: ^int
p^ = 10

Ecosystem and usage

[edit]

Odin includes a "core" library for standard functionality (IO, math, networking) and a "vendor" library. The vendor library integrates popular third-party C libraries, such as OpenGL, Vulkan, SDL, and Raylib, directly into the distribution to facilitate immediate development for graphics and games.

Notable software

[edit]

The most prominent commercial usage of Odin is by the software company JangaFX, which uses Odin for its real-time simulation tools used in film and game production.[3]

References

[edit]
  1. ^ a b "Odin FAQ: History". Odin-lang.org. Retrieved 17 January 2026.
  2. ^ a b c "Odin Programming Language documentation". Odin-lang.org. The Odin Programming Language. Retrieved 17 January 2026.
  3. ^ a b "VDB Deep Dive". JangaFX.com. Retrieved 17 January 2026. It is written in the Odin programming language, which we use at JangaFX for developing our products.
  4. ^ "Introduction to Odin". LearnOdin.org. Retrieved 17 January 2026.
  5. ^ a b c d "Compare Languages: Odin". c3-lang.org. C3 Language Project. Retrieved 17 January 2026.
  6. ^ Zylinski, Karl. "Structure of Arrays in Odin". Odinbook.com. Retrieved 17 January 2026.
  7. ^ a b Hall, Bill (15 December 2025). "context—Odin's Most Misunderstood Feature". gingerbill.org. Retrieved 17 January 2026.
[edit]