by pitaj · 3y ago · 0 comments
In my opinion:
- Rust is more productive than C
- Rust is easier than C, once you get past the initial bump
And it's not my opinion, it's just fact that Rust has practically the same performance as C.
I say this as someone who is currently actively maintaining embedded firmware with 10,000+ lines of C. It will be my last significant C project.
Rust macros are a disaster.
The whole kerfuffle around async and what had to be put into the compiler shows that Rust features don't compose well and don't allow the language to extend to unhandled cases cleanly (see: Pin).
#![nostd] still doesn't handle alternate memory allocators all that well.
My wishlist is C with just a bit of the Rust borrow checking and safety. I suspect that Zig or D will be able to get 80% of Rust's safety while only gaining 10% of Rust's complexity.
I disagree. We're finding that it's a great replacement for C++, C, C#, and Java. It even fits to replace or compliment scripting languages like JavaScript, Python, Ruby, etc.
> Rust macros are a disaster.
Better than C macros or no macros at all. Could it be better? Certainly.
However, I don't think that Zig comptime is capable of the very important things that Rust macros enable.
> The whole kerfuffle around async and what had to be put into the compiler shows that Rust features don't compose well and don't allow the language to extend to unhandled cases cleanly (see: Pin).
Actually, I consider Pin as a triumph of the Rust way. By adding a simple rule (do not move this) you get enable a bunch of useful properties. And it only affects things which need it. It requires some understanding of you're working with it in unsafe territory, but the API surface keeps things safe for the average user.
> #![nostd] still doesn't handle alternate memory allocators all that well.
I don't know enough about it to say otherwise.
> My wishlist is C with just a bit of the Rust borrow checking and safety. I suspect that Zig or D will be able to get 80% of Rust's safety while only gaining 10% of Rust's complexity.
All of your problems with Rust are being worked on. Most of the missing features and pain points I see bright up are really just cases where the language hasn't filled the whole multidimensional space where orthogonal features interact.
Based on pace of development, you might see Rust fill out before Zig or especially D fulfill your dreams. Especially if you want actual memory safety.
So far this makes a lot of sense.
> […] C#, and Java. It even fits to replace or compliment scripting languages like JavaScript, Python, Ruby, etc.
Well, I see you found a new hammer.
I for my part would say that Rust is overly complex for most things where C# or Java, and especially any Scripting language, would be a good fit.
But that's the cool thing about a hammer. You can use it use it for everything! Even eat soup with it. ;-)
> Based on pace of development, you might see Rust fill out before Zig or especially D fulfill your dreams. Especially if you want actual memory safety.
But you know that D has a GC by default? You can't be "more memory safe" than that.
So I really don't get the remark about D here.
Algebraic data types, which none of those languages have, are incredible for representing states in your program. They help reduce our eliminate the type of logic bugs that often show up in UIs and such.
The lack of null and using Options instead is one such example.
Rust has fantastic libraries like serde which make de/serialization fast without a need for reflection.
In short, the Rust ecosystem has a tendency to produce amazingly helpful abstractions.
> But you know that D has a GC by default? You can't be "more memory safe" than that.
First of all, D with GC is not a replacement for C. Anything with a GC is not going to fulfill a systems language role.
Secondly, you can be more memory safe than a GC. Most GCs do not protect against data races, but Rust does. I'm unsure exactly where D falls there.
I don't agree. I'd rather have no macros because that would increase the pressure on the core language and compiler to evolve properly.
Any usage of macros that has to atomize down to the molecules of the syntax tree and then reassemble them from the ground up is screaming Language Failure Here. Those kinds of macros should only exist until the core language either vacuums up the construct and makes it standard or declares the construct verboten at which point they should be excised.
Instead, Rust's procedural macros are spreading like the plague throughout the ecosystem.
> All of your problems with Rust are being worked on.
Unfortunately they're not being completed--which is far more important.