http://bitshifters.cc/2025/05/04/odin.html
Bitshifters [ ]
Home
Odin, A Pragmatic C Alternative with a Go Flavour
May 4, 2025
Odin is a general-purpose systems programming language authored by
Bill "gingerBill" Hall. Designed as a modern alternative to C, Odin
emphasizes simplicity, performance, and readability without
sacrificing control over low-level details.
The website says it's "data-oriented", and features such as SOA
(structs-of-arrays) and implicit zero initialization tie into that.
Despite this focus, the language surprisingly has dynamic maps and
arrays built into the language itself. While the memory is still
manually managed, it's uncommon to see such built-ins.
This perhaps sets the tone of Odin: it tries to be ergonomic and easy
to write by offering a lot out of the box. Odin also comes with
"vendor", containing bindings to a wide variety of popular libraries.
This makes the language very easy to get into.
Design Philosophy
Odin focuses on practical solutions to real-world programming
challenges--in other words, it favours pragmatism over idealism (I'll
return to this when I later discuss Zig). Rather than introducing
complex features, Odin focuses on code that is simple and clean to
read and reason about. This is the polar opposite of Zig's embracing
of metaprogramming for as much as possible.
Odin also has a fairly old-fashioned view of types. The current trend
is to make programming languages increasingly more complex so that
they can describe more and more types in the language itself. Odin
instead harkens back to older languages where built-in types
flourished. Consequently, Odin does not just offer the aforementioned
hashmaps and dynamic arrays, but also numerical types such as complex
numbers, vectors, matrices, and even quaternions. This makes up for
its rejection of operator overloading by a wide margin. It's not a
coincidence that the flagship app to demonstrate Odin's capabilities,
EmberGen, is a math- and graphics-heavy tool.
A quick look at the syntax
Odin has a fairly straightforward syntax for a beginner. The fact
that there is no excessive nagging about mutability or constness
makes things just work as expected.
The declaration is otherwise very inspired by Jai and fairly minimal.
Odin's concession to modern fashion shows up in its removal of the
traditional ;.
Odin produces code anyone used to C or other low level languages can
read at a glance. Here is a short "move the dot around the screen"
using Raylib:
package test
import rl "vendor:raylib"
main :: proc()
{
rl.InitWindow(1280, 720, "Testing")
pos : rl.Vector2 = { 640, 320 }
for !rl.WindowShouldClose() {
rl.BeginDrawing()
rl.ClearBackground(rl.BLUE)
rl.DrawRectangleV(pos, {32, 32}, rl.GREEN)
if rl.IsKeyDown(.LEFT) {
pos.x -= 400 * rl.GetFrameTime()
}
if rl.IsKeyDown(.RIGHT) {
pos.x += 400 * rl.GetFrameTime()
}
if rl.IsKeyDown(.UP) {
pos.y -= 400 * rl.GetFrameTime()
}
if rl.IsKeyDown(.DOWN) {
pos.y += 400 * rl.GetFrameTime()
}
rl.EndDrawing()
}
rl.CloseWindow()
}
All in all, Odin's syntax mostly feels familiar, even with changes to
things like function declaration syntax. There are no deep quirks;
the changes are superficial.
This conservative streak in Odin is echoed by others. Dale Weiler, at
JangaFX, was an early adopter. He wrote on his blog:
All in all, Odin's syntax mostly feel familiar, even with changes to
things like function declaration syntax. There are no deep quirks,
the changes are superficial.
"Odin is a systems programming language that is more conservative
in its design than other newer programming languages such as
Rust, Zig, and Carbon. The design ideology around Odin is to
provide some greatly needed quality of life improvements over the
lingua-franca of systems languages: C, while still staying as
simple as C." link
It's clear that Odin has pulled off the trick of feeling familiar
even if the syntax is much different from C.
Error handling
Odin's most controversial choice is probably the error handling,
which uses multiple returns in the fashion of Go. And while Odin
offers better ergonomics with or_else and or_return, it can feel
clunky compared to other solutions.
As far as first impressions go, this choice is probably not ideal. It
seems like a common thing to criticize. On the other hand, this
conceptual simplicity goes hand in hand with the straightforwardness
that is the trademark of Odin's design.
The Joy of Programming
Odin shares the "joy of programming" slogan with Jai, but the
appreciation seems to be real. To quote one user:
"Odin has renewed my joy of programming. Built-in bounds
checking, slices, distinct typing, no undefined behavior,
consistent semantics between optimization modes, minimal implicit
type conversions, context system, and the standard library
tracking allocator combine together to eliminate the majority of
memory bugs I found use for sanitizers in C/C++." link
Another user writes:
*"[...] moving from C to Odin was quite a pleasant and rather easy
experience. The languages are rather similar but Odin takes the
painful bits away, letting you to focus on the problem instead of
wondering why something is going weirdly wrong again." link
Just taking the language for a spin, it's friendly and does what you
think. It's essentially an approachable language that just feels nice
to use.
Comparisons
Jai
Odin and Jai share syntactic similarities, but their approaches
differ. Where Jai emphasizes compile-time execution and
metaprogramming, offering powerful abstractions, Odin instead focuses
on simplicity and lots of features out of the box.
While on a syntactic level Odin clearly took inspiration from Jai,
the two languages have evolved very differently. Jonathan Blow stated
in a video that Jai has grown more complex than he planned.
Odin, on the other hand, is clearly a language that feels simple to
learn and use.
Zig
Both Odin and Zig aim to modernize systems programming, but they
clearly diverge in philosophy. Zig offers extensive compile-time
metaprogramming (although not to the level of Jai), whereas Odin only
retains the necessary functionality needed for conditional
compilation.
Odin, like Jai, has runtime reflection. Zig's reflection, on the
other hand, is generally limited to compile time. In practice, this
means Zig relies on a lot of metaprogramming to do things like
serialization through type inspection, whereas in Odin it's available
at runtime, so the code is magnitudes easier to understand.
The biggest difference is its attitude toward the programmer's
experience. Odin tries to be simple and make it fun and pleasant to
program in; it has a straightforward, no-fuss syntax.
Zig, on the other hand, cares little about the user experience and
prefers verbose explicitness over convenient abstractions.
A developer compared the two:
"Zig is very verbose... Odin in comparison is very minimal in terms
of typing while communicating basically the same info." link
Criticisms
While Odin has been in use by projects for quite a while, the
official documentation is still lacking in depth and examples. On top
of this, it seems that the primary community platform is Discord,
which may not be accessible to all.
There have been people criticizing the lack of more extensive
metaprogramming. But with access to type information at runtime and a
fairly wide array of built-ins, it is not clear whether this has any
merit.
For example, both Zig and Jai offer support for struct-of-arrays
through metaprogramming. In Odin, however, this feature is built into
the language.
Conclusion
Odin presents a compelling option for developers seeking a modern,
efficient, and readable systems programming language. That it is
successful in graphics-intensive applications like EmberGen
demonstrates its robustness and performance. While it has areas for
growth--particularly in documentation and community
accessibility--Odin's pragmatic design and focus on developer
experience make it a worthy alternative to C for contemporary systems
programming needs.
Bitshifters
* Bitshifter
Opinions on programming languages and software