this post was submitted on 25 Sep 2024
879 points (87.3% liked)
Programmer Humor
19623 readers
2719 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Is Rust as close to the metal as C? Seems like there would still be a need for C. I could see Rust replacing Java as something that's so ceremonial and verbose, but from my limited perspective as a sometimes java dev, having only the most glancing experience with C, it seems like C would be hard to replace because of what it is. Buy I honestly don't know much about Rust either, I just think JS is so finicky and unpredictable whereas web assembly seems extremely fast and stable.
Rust can create native binaries but I wouldn't call it close to the metal like C. It's certainly possible to bootstrap from assembly to Rust but, unlike C, every operation doesn't have a direct analog to an assembly operation. For example Rust needs to be able to dynamically allocate memory for all of its syntax to be intact.
Hmm, you got an example of what you mean?
Rust can be used without allocations, as is for example commonly done with embedded.
That does mean, you can't use dynamically sized types, like
String
,Vec
andPathBuf
, but I wouldn't consider those part of the syntax, they're rather in the std lib...So you're right that this is a bit arbitrary because the line between the standard lib and the language is blurry, but someone writing Rust is going to expect Vec to work, it doesn't even require an extra "use" to get it.
Perhaps a better core example would be operator overloading (or really any place using traits). When looking at "a + b" in Rust you have to be aware that, depending on the types involved, that could mean anything.
Anyway, I love Rust, it just doesn't have the 1:1 relationship with the assembly output that C basically still has.