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

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] affiliate@lemmy.world 6 points 1 month ago (2 children)

i think it’s mainly people being cranky and set in their ways. they got used to working around all the footguns/bad design decisions of the C/C++ specifications and really don’t want to feel like it was all for nothing. they’re comfortable with C/C++, and rust is new and uncomfortable. i think for some people, being a C/C++ developer is also a big part of their identity, and it might be uncomfortable to let that go.

i also think there’s a historical precedent for this kind of thing: when a new way of doing things emerges, many of the people who grew up doing it the old way get upset about it and refuse to accept that the new way might be an improvement.

[–] Feyd@programming.dev 8 points 1 month ago

Some rust proponents having this attitude is probably part of the problem.

[–] Juice@midwest.social 5 points 1 month ago (3 children)

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.

[–] themoken@startrek.website 5 points 1 month ago* (last edited 1 month ago) (2 children)

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.

[–] Ephera@lemmy.ml 7 points 1 month ago (1 children)

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 and PathBuf, but I wouldn't consider those part of the syntax, they're rather in the std lib...

[–] themoken@startrek.website 2 points 1 month ago

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.

[–] Juice@midwest.social 3 points 1 month ago

Thank you for the explanation.

[–] LPThinker@lemmy.world 2 points 1 month ago

I mean, the simple proof is that Rust has been growing by leaps and bounds in the embedded world, which is the closest to bare metal you get. It’s also being used in the Linux kernel and Windows, and there are several projects building new kernels in pure Rust. So yeah, it’s safe to say that it’s as close to the metal as C.

Also, the comparison to Java is understandable if you’ve only been exposed to Rust by the memes, but it doesn’t hold up in practice. Rust has a lot more syntax than C (although that’s not saying much), but it’s one of the most expressive languages on the market today.

[–] frezik@midwest.social 2 points 1 month ago* (last edited 1 month ago) (1 children)

It's slightly less close to the metal as C. Array bounds checks are always going to cost you something, for example. However, if you look at the speed of numeric computation in C, Rust, and Go, they're all in the same order of magnitude performance compared to things like Python or JavaScript (not including things like PyPi, which is C with extra steps).

[–] Juice@midwest.social 2 points 1 month ago (1 children)

Wow thanks so much for breaking that down for me! The discussions I've been having here and the information devs are sharing is really kicking me off the fence about learning Rust

[–] frezik@midwest.social 2 points 1 month ago* (last edited 1 month ago) (1 children)

Eh, I'd still go for it. I find the Rust compiler tends to amplify my impostor syndrome--it tells you all the ways you are objectively being stupid. I know that's not really selling it, but it's doing that stuff for a reason. I'm especially hopeful that it becomes the standard way to do things with microcontrollers; that's about the only place I write C/C++ at all.