Hacker News new | ask | show | jobs
by pjmlp 22 days ago
I kind of like Odin, with its Pascal/Modula-2 influences, even if the community is a bit hardcore on some of their ideas.

Love the books in the background, and the whole video.

It is also nice that Odin takes the batteries included approach.

How well it would fair in the mainstream remains to be seen.

2 comments

What kinds of project would Odin be best suited for, as compared to, say, Rust or Go?
By far the best feature (IMO) is that it has no trouble talking to the most important Windows COM libraries (like DirectX) and the Objective-C runtime (for Metal), and this comes as "batteries included", not some random third party library you have to download.

So for any sort of visual engine development (game engines being the most obvious, but also applications like blender or the JangaFx suite which is the main user of Odin), it is great. What you need is just there ready to go.

The language design itself is very much oriented around appealing to people who do this sort of work.

Other than there isn't much to the language really. It lacks a "big idea" feature like Rust's lifetimes or Zig's comptime. The closest thing to a "big idea" is the rejection of package managers but that's not really part of the language.

It's pleasant to use and compiles fast. Hard to complain.

Game development.

Go really only took off thanks to Docker and Kubernetes, and even if it would be capable, there is hardly an ecosystem there.

Rust could be there, but there is really only Bevy, and several companies have tried it and pivoted to something else due to compile times hindering fast prototyping workflows.

Odin was created at a games company, JangaFX, and has already a few products using it.

https://jangafx.com

Also Odin batteries include what you need to start coding a game right away, https://pkg.odin-lang.org/vendor

JangaFX isn't a games company. They make visual effects tools and are probably best known for their fluid simulations.
That is debatable, given their customer portfolio.
How is it debatable? Their products aren't games...
Depends on what you mean by the term: Some companies are in the business of supporting game studios without being game studios themselves (eg animation companies you outsource your out-of-engine cinematics to). If all your customers are game studios, you could be argued to be a 'game (support) company'.
Anything you'd use C or C++ for. Graphics, finance, simulations, native GUI apps, command line tools, etc...

Semantically it's quite C-like, but it's got some nice modern features like a real module system (Odin calls it packages), a project-aware compiler (no build system needed, just run "odin build ." in your project root), fast compile times, and some nice quality of life stuff (good string type, good maths library, built in array maths, some nice built in stuff for memory management). It's also fast. Like in the same ballpark as C, C++ or Rust.

It's basically a modern C replacement.

Interactive applications where a GC is not an option.

Rust is shockingly good at being a general purpose language, but that's in the face of the strict semantics of the language and approach to memory. There became a comparison against Go because Go offers strong performance and a complete opposite memory-management experience (in having a GC that largely solves it for you.) Odin sits between these two levels of friction, leaning far more on the Go side of things. There are goodies in Odin which make memory management much breezier than other manual languages, but I'll admit it is still a task you are expected to complete.

So that's the story on the memory-management effort. That aside, I'd say Odin is best for interactive applications where a GC is not an option. Although at this point it comes out of my hands so easily that I'd probably write Odin in some situations where it'd be less optimal, and it'd be fun so why not?

At the level of this question, with most responses addressing Odin versus Rust or Go as in the question, I'd have been curious for community thoughts adding in Nim and Swift (now that Swift is on Linux and in any IDE that can use SourceKit-LSP).

https://www.swift.org/install/linux/

See:

"A series of small programs/tasks to compare C++, Go, Zig, Odin, D, Janet, Swift, Nim and C# to see which I like the most"

https://github.com/phillvancejr/Cpp-Go-Zig-Odin

I used to be a huge fan of Swift but eventually got frustrated that they just don't seem interested in officially supporting anything other than macOS and mainline Linux; any support for BSD or Windows is only through iffy community projects. I can't recommend Swift if you want your project to be broadly multi-platform.
Personally, of that sample I prefer Go and Odin. I find compilers to be terribly fun puzzles, and I love to learn languages inside and out. That's great and all, but I also have to get things done, and I find Go and Odin have a certain... rudimentary feeling which keeps me focused. Go less-so than Odin. I've written quite a lot of Swift in my life, and find it to be the absolute worst language for me in terms of this kind of "distracted energy." There are so many ways to abstract things in Swift, the tool bag is just so deep, and I do get a bit frustrated by the sluggishness of the compiler. I had a work project take us 30 minutes for a clean build, and those of us who have used Xcode know that unfortunately a clean build is not as rare as in some other systems. Maybe this has changed. It's been 4 years since I've done serious work with Swift. Glad to see they stopped making so many breaking changes, though.

EDIT: Actually Typescript is more distracting than Swift. I could spend days toying with the type-checker to make the program sturdier against one change or another.

Game engine programming, more generally projects where the programmer controls the spec and data. More specifically, passing custom allocators to specific subsystems.

That may sound like "Q:why buy this truck? A:Cos it has a nice oil filter" but it marketed as a language "[for the] joy of programming".

Perhaps the goal is to get more people into programming following the same playbook as the scripting wars we had in the 2000s. Or it's part of a larger trend to get mind-share away from c.

Odin is not the only language with Pascal influences, as that applies to Golang and Vlang too.
Sure, but at least Odin embraces more stuff than Go, with its design mindset.

It has naturally the influences that came via Oberon-2.