HACKER Q&A
📣 throwawaydsstr

Alternatives to Rust Programming Language


I have been evaluating new low level programming language to learn and for my project.

Rust is deemed good but recent drama/resignation and quite difficult trajectory to master it has made me to search for alternatives.

I don't want to program in C and I don't want to deal with complexity, that is C++

So, what is best alternative to Rust apart from C and C++ ? It would be better if that language has innovative features (like borrow checking to write safe code)


  👤 fleventynine Accepted Answer ✓
Ignore the drama. The language in its current state is great, and will survive bureaucratic spats.

Other languages may be more ergonomic or have more batteries included, but none of them can offer the holy grail of memory safety without garbage connection.


👤 holonomically
Zig and Nim are good bets. Both are pushing the state of the art forward on what is possible with system programming languages. D is probably another good bet.

👤 ameliaquining
If you need memory safety, precise control over low-level runtime behavior (e.g., no tracing garbage collector), concurrency, and a strong ecosystem, Rust is pretty much your only option.

The alternative that comes closest to being viable, in my view, is Swift. Swift currently offers memory safety or concurrency, but not both at once. They're working on fixing this, but they haven't yet. Additionally, hopes that it would grow a strong ecosystem for non-Apple platforms (like Linux servers) don't seem to have panned out, largely because Apple owns the language and they don't seem to care very much about this use case.

As for the other low-level languages I'm aware of that aren't C or C++ or assembly and aren't hopelessly obscure:

Ada seems to be interested in adopting Rust-style memory safety, but (as far as I understand) it hasn't yet. It's also not a widely-used language with a strong ecosystem, at least outside of some narrow application domains that probably aren't what you have in mind.

D offers memory safety or precise control over low-level runtime behavior, but not (as far as I understand) both at once. It also doesn't have a strong ecosystem.

Jai doesn't have a publicly available implementation.

Nim offers precise control over low-level runtime behavior or concurrency, but not both at once (because threads can't share memory; there seem to be ways around this with globals but I'm not sure if they let you do everything you can do in C/C++/Rust/Swift). Also, precise control over low-level runtime behavior isn't the default; you have to opt in. And it's not a widely-used language with a strong ecosystem.

Objective-C isn't memory safe, has no plans to fix this, and its ecosystem is likely to decline with time as Apple pushes people to abandon it in favor of Swift.

Verona is a research project without a working implementation yet.

Zig isn't memory safe and has no plans to fix this. It also doesn't have a strong ecosystem. (I don't know anything about its concurrency support.)

If you don't need precise control over your program's low-level runtime behavior, then there are many options available to you. (Go, despite sometimes being marketed as a "systems" language, is in this category; I would also classify Julia, Kotlin/Native, and V here.) More details about your requirements would be needed in order to choose among them.


👤 _iziv
Ada. Old, but stable, with most of the same safety and speed.

👤 ksec
Crystal. Someone wrote an OS out of it, but if you don't like GC then;

Zig, my view is that it is practically a modern take on C, or commonly known as Better C.

There is "Das C" or "D as C", if you are looking for something similar to Better C.

Or if you want something that is extremely well polished, Ada.

But we are all on HN after all. So it is only fair to say nothing can ever be as good as Rust if you want memory safe. You should just ignore the drama and use Rust.


👤 OJFord
Do you really care about the resignation of the moderation team when evaluating a programming language to use?

It doesn't affect your usage of it at all.


👤 kgraves
Crystal? It recently reached 1.0

https://crystal-lang.org/


👤 DLA
If you want to work on distributed systems, Web backend, services, command line tools, etc, give Go (golang.com) a look.

👤 errantspark
Roughly speaking your options are something like D, Zig, Nim, and Crystal.

I would say your best bet actually is Rust in terms of RoI on self-investment. Rust likely has the brightest future and the most active community, good docs and momentum to build out crates to do the day-to-day things you'll end up tackling.

That being said I gave Rust a hard look a couple years ago, got through most of the book but if I need something to happen on time I still find myself reaching for C nine times out of ten. Personally I rarely deal with things that get too complex so C's ability to just do the thing you want without getting in your way is invaluable to me. If it ever becomes a problem I think that's the time to rewrite in in Rust, but C is a fantastic language.


👤 ynik
Don't forget that other languages also have community drama.

Just because Rust's drama made it to the HN front page this day doesn't mean that other languages are any better in the drama department -- I think it just means that HN is obsessed with Rust.


👤 nice_byte
i see zig as a potentially good alternative, however as of now the learning curve might be steeper than rust - not because of the language itself, but because of the poor state of the documentation. you might need to e.g. read the code of the std lib to figure out how to do certain things.

it needs more time to bake, but i'm looking forward to it.


👤 mindcrime
Ada or D are the first options that jump to my mind. Maybe Swift as a possibility as well?

👤 tengbretson
If its just for a fun personal project it might be interesting to try out Vala.