Zig vs Rust. Which one is going to be future?
I think about pros and cons and what to choose for the second (modern) language in addition to C.
Zig vs Rust. Which one is going to be future?
I think about pros and cons and what to choose for the second (modern) language in addition to C.
Rust. It’s a qualitative improvement over the old ways.
The future won’t belong to Rust itself, but one of its descendants. Rust is too clunky to be the ultimate expression of its best ideas.
In what ways do you feel Rust is too clunky and how do you think it could be improved? Not looking to argue or even disagree necessarily; I’m just curious where that perspective comes from.
removed by mod
Here’s some of my personal complaints. I don’t in general know how to fix them.
proc_macros need their own crate
generics cause problems. Many useful macros can’t handle them. Try using a generic that’s a complex async function, then pass a closure to it.
There’s this kind of weird mismatch where sometimes you want an enum wrapping various types, and in others generics. I find my data flows switching back and forth.
async in rust is actually really good, but go does it better. I don’t think rust could match go without becoming a different language.
Traits are just a big mess. Trait implementations with generics have to be mutually exclusive, but there aren’t any good tools to make them so. The orphaned trait rule is necessary to keep the language sane but is incredibly restricting. Just today I find certain a attribute macros for impls that doesn’t work on trait impls. I guess I have to write wrappers for every trait method.
The “new type” pattern. Ugh. Just make something like a type alias that creates a distinct type. This one’s probably easy to fix.
Cargo is truly great, but it’s a mystery to me right now how I’m going to get it to work with certain packaging systems.
To me, Rust is a bunch of great pieces that don’t fit together well.
That might change over time.
Have… you met C?
Do tell.
That guy that causes pretty much every major code based security vulnerability?
What does Rust improve over its predecessors? The only really new thing is the borrow checker, which is only useful in very low-level programming.
It also has real type safety and thread safety.
What do you mean by its predecessor? C++? I think rust has a bunch of advantages. For one, designing a new language today gives you the benefit of hindsight meaning that they have a more cohesive set of features and a nicer standard library compared to C++ that has some bloat and cruft as a natural result of it evolving over several decades. It’s also much easier to reason about undefined behavior in rust thanks to
unsafe
. Algebraic data types are really nice and traits are better than classes.The borrow checker isn’t just useful for low level programming. One of the other main selling points is “fearless concurrency” or essentially the fact that the borrow checker can help you reason about thread safe vs non thread safe data.
Does it need more than the borrow checker if it’s a game changer?