The problem with Rust it appears,
that it leaves programmers in tears
if they have to go back
to languages that lack
in short they've got feature-arrears.
by @llogiq on r/rust, commenting on a post titled “I never want to return to Python”.
The problem with Rust it appears,
that it leaves programmers in tears
if they have to go back
to languages that lack
in short they've got feature-arrears.
by @llogiq on r/rust, commenting on a post titled “I never want to return to Python”.
The Rust mission -- let you write software that's fast and correct, productively -- has never been more alive. So next Rustconf, I plan to celebrate:
- All the buffer overflows I didn't create, thanks to Rust
- All the unit tests I didn't have to write, thanks to its type system
- All the null checks I didn't have to write thanks to Option and Result
- All the JS I didn't have to write thanks to WebAssembly
- All the impossible states I didn't have to assert "This can never actually happen"
- All the JSON field keys I didn't have to manually type in thanks to Serde
- All the missing SQL column bugs I caught at compiletime thanks to Diesel
- All the race conditions I never had to worry about thanks to the borrow checker
- All the connections I can accept concurrently thanks to Tokio
- All the formatting comments I didn't have to leave on PRs thanks to Rustfmt
- All the performance footguns I didn't create thanks to Clippy
Adam Chalmers in Rustconf 2023 recap
There is no simple way to writing correct code, you just can have a compiler that helps you or not, those are our options at the moment.
The default answer to all feature requests is "no, make a library"
@scottmcm in How to suggest a feature to be added to rust compiler - #3 by scottmcm
When your #Rust build times get slower after adding some procedural macros:
We call that the syn tax
After doing a best fit, we found #Rust projects were less likely to introduce vulnerabilities than their equivalent #C++ projects at all relevant experience levels, but more importantly, we found the effect was most significant for first-time contributors, who were almost two orders of magnitude less likely to contribute vulnerabilities. That is, even though Rust may have a reputation as a harder language to learn, there is a very measurable effect that makes it better for newbies. Reviewers should not have to put as much effort into reviewing code to be confident that someone making their first foray into their project is accidentally adding a vulnerability.
From Alice Ryhl on the Linux Kernel Mailing List:
For Binder to continue to meet Android's needs, we
need better ways to manage (and reduce!) complexity without increasing
the risk.The biggest change is obviously the choice of programming language. We
decided to use Rust because it directly addresses a number of the
challenges within Binder that we have faced during the last years.
On last week's TWiR I read the following qote in Was Rust Worth It? by Jarrod Overson:
Programming in Rust is like being in an emotionally abusive relationship. Rust screams at you all day, every day, often about things that you would have considered perfectly normal in another life. Eventually, you get used to the tantrums. They become routine. You learn to walk the tightrope to avoid triggering the compiler’s temper. And just like in real life, those behavior changes stick with you forever.
The framing of this is a bit unfortunate, and after I shared it in my friend group someone came up with a different framing:
I would say that programming in rust is like being in a relationship with someone who's tidy and organized. Rust is gonna get annoyed with you for leaving the lights on. Rust is gonna get annoyed with you for opening the window with the aircon on. Rust is gonna get annoyed with you for leaving the water running. Rust is gonna get annoyed with you for leaving clothes and other junk all over the floor. Rust is gonna get annoyed with you for letting the dishes pile up. You never had to worry about these with javascript! Javascript was chill, javascript would never yell at you for any of this. It feels kind of bad, like rust is kind of a clean freak. It's overbearing, but then at the end of the month you look at your utility bills and they're soooo much lower than they ever were with javascript, and then you realize that you can't remember the last time you misplaced something underneath the layer of junk on your floor. Now you don't dread cooking anymore because the kitchen is organized and you can actually find all of your spices because you have a dedicated spice cabinet and you just have to worry about cleaning the dishes you used today instead of all of the dishes from the past month.
This quote can be attributed to Poyo_SSB if it makes it to TWiR
Good grief that says more about the author of that statement than it does about Rust. Rust does not scream at me or have tantrums. I have constructive discussions with the compiler.
How about "Programming in Rust is like playing in the yard with your loving mother watching out that nothing bad happens to you."
But really, personifying these things is not very meaningful.
Dude still got it backwards. Having "someone" (something) catch your mistakes is liberating and good, not bad.
I really despise both excerpts and think that they shouldn't be Quote of the Week.
True, but I think a shared experience for some people is that -- after some initial very nice compiler errors that almost let you leave your c induced segfault trauma behind -- the compiler informs you about a lot of things that you don't really understand and don't want to think about. So it does feel like someone is nagging you. The goal of the story is to foreshadow a time in which you got used to the compiler errors and welcome the change in thinking it introduced and what you learned from it.
Are you talking about the Rust compiler or C++?
I guess compiler error trauma is greater for those who have never used a compiled language but I'm not seeing it as worse with Rust.
When I’m writing UI code in JS, I tend to run a lot of programs that aren’t finished yet. I have parts of it built, and want to try them out to see if it “feels” good to actually use, even though I know perfectly well that some of the functionality is missing.
You can, technically, do that in Rust, but you have to explicitly stub out the missing parts with todo!()
, which is annoying enough to do that I’ll probably just finish the design instead.
The trauma I was refering to is C compilers not giving you any errors and then just segfaulting at runtime. I just realized that that's not even a compile time issue. At the time I came from python and back then compile time and runtime where new words to me.
And your're right, apart from some errors being hard to understand because the error they describe is complex the error messages in rust are wayyyy better than what any Cpp compiler I encountered can give you.
Ah yes, that trauma hit me when I first learned C in the early 1980's. I was shocked to find the compiler would build totally non-functional executables that crashed in mysterious ways and often required the machine to be rebooted (MS DOS days).
That surprised me even though I had prior experience of a compiled language. ALGOL did not do that.
This is why these days for me the number one selling point for rust is "No UB in safe rust". Much more than anything else.
As someone who successfully avoided using memory-unsafe languages until picking up a DOS retro-programming hobby after learning Rust, I'd say the best argument for people coming from the other side is either the amount of "if it compiles, it works" that you can encode in the type system, or the large ecosystem of things like PyO3, Wasmer, etc. that allow you to write code once and reuse it across all languages you write.
As suggested in the linked thread, I'm nominating this comment (or some part of it) to TWiR quote of the week:
I just wanted to say a huge thanks to everybody involved in producing the experience that is Rust. Things I highly value in Rust:
- community: it could so easily have adopted the worst of the Haskell mindset, and yet, for the most part, it is welcoming, accessible, friendly, and supportive.
- cargo-fmt: I really appreciate how unconfigurable it is - consistency general wins, particularly when it comes to subjective styling.
- test: the inbuilt testing framework is good enough. One more piece of the "on ramp" provided for you
- traits: the strategy pattern in all its glory. Ok, there is a little too much machinery around them (
Box
,dyn
,impl
,Sized
etc.), but that's an experience thing.- enums: sum types as a front-and-centre programming construct. They are exactly the right tool for expressing, well, sum types! One of this, or that, or those.
- the three bears: just enough FP, just enough procedural, and just enough OO
- cargo/workspaces: move over maven, ant, gradle, etc., go home, you're drunk!
- performance: it's just so fast for such a high level programming language.
- std lib: it has a very large std lib, but thanks to judicious use of
trait
s it isn't overwhelming.- clippy: a pedantic, opinionated, and vocal opinion on these sorts of decisions has replaced a large part of my job ;-). I don't know why it isn't more used instead of
check
.cargo clippy --fix --all
is just <chef's kiss>- solid: the language and core machinery around rust is just rock solid. At least, I haven't run into any issues that haven't turned out to be either well documented, my misunderstanding, my false assumption, or me being a muppet.
- documentation: the std library documentation, and community crates in general, are excellent. Good doc takes far more time than good code, so thank you.
- you: thank YOU for putting your time and effort into this wonderful project.
Of course, there are pain points, and there are some gotchas on the on-ramp, but they are a small price to pay.
So again, thank you. Now, turn off your computers and go play with your kids, pets, buddies, or failing all of that, go and donate some time to your local community :-).
Thanks everyone - community - The Rust Programming Language Forum
Today @Yandros took me on an epic journey to Mordor through their struggles with specialization when I stumbled across one of the most hilarious doc comments I've ever read:
Behold, the smoking remains of some ravaged Rust code, the result of an
invocation gone awry, for Yandros had been awakened from their slumber.The Intelligence Dampening Sphere, thinking it could overtake Rust and its
constraints, had engaged in a devastating battle.But the Crab was no easy creature to subdue, and no matter how many
cursed poorman specialization stabs were taken against it, the Crab remained,
unscathed.Unwilling to admit defeat, the challenger, desperate, started chanting an
ancient incantation from the forbidden times, unwittingly dooming us all:#[allow(unstable_features)] #[feature(specialization)]
The Crab immediately unleashed an ear-piercing shriek of pain, after which
there was no sound: complete and utter silence.
Tread carefully among these paths, adventurer, and forgo any hope for sane
Rust code.
Never seen spezialization in action, but I imagine this is what it does to people. I've spent most of the day staring at the code and I've still no idea what I'm looking at.
I decided to keep learning Rust because I liked the syntax. I liked the speed. I liked the community. I liked it all. It felt like a breath of fresh air: a syntax more intuitive than Python, JavaScript, or C, yet still faster.