TWiR quote of the week

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 :slight_smile:


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.

1 Like

Are you talking about the Rust compiler or C++? :slight_smile:

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.

1 Like

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 traits 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,

Unwilling to admit defeat, the challenger, desperate, started chanting an
ancient incantation from the forbidden times, unwittingly dooming us all:


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.


On the topic of "hyperoptimisations"...


Thanks for nominating my quote. Although it seems to miss a bit of context within the the rust newsletter😅

From Is Rust compile time really that slow?


Just ran across this little pearl:

The entire post is worth reading, it's a fun little rant.


For some reason, people named Daniel write the funniest posts :man_shrugging:. I've thought about creating a dedicated topic for hilarious posts (which too often don't make a good enough quote of the week, unfortunately). I'm pretty sure @DanielKeep and @Yandros would fill this hypothetical topic with lots of great content.