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 (
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
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
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.
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 . 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.
A little late, compared to the October post date, but I thought people might appreciate this:
Fighting with someone else's stupid is often easier than creating a new custom stupid to fight with all while maintaining the new stupid.
-- jwarnica on the question of why the Linux kernel doesn't create a
moc-style preprocessor or get a new dialect merged into GCC to fix the stuff they keep coming up with new library-level workarounds for @ Better string handling for the kernel [LWN.net]
(Thanks to smoogen for ensuring I had "quote of the week" on the mind.)
The Tianyi-33 Satellite Equipped with RROS Successfully Entered Orbit. | RROS
The Tianyi-33 satellite is a 50kg class space science experimental satellite equipped with an operating system independently developed by Beijing University of Posts and Telecommunications—the Rust-based dual-kernel real-time operating system RROS. RROS will carry out general tasks represented by tensorflow/k8s and real-time tasks represented by real-time file systems and real-time network transmission on the satellite. It will ensure the normal execution of upper-layer applications and scientific research tasks, such as time-delay measurement between satellite and ground, live video broadcasting, onboard web chat services, pseudo-SSH experiments, etc. This marks the world’s first official application of a Rust-written dual-kernel operating system in a satellite scenario.
Today I introduce you to Ferris' law: "Any application that can be rewritten in Rust, will eventually be rewritten in Rust".
This is a "self proposal", hopefully you find the joke funny.
Rust can be rather more verbose than C; there are a lot of invariants that have to be expressed in the code. But that is countered by the need for far less error-handling code; it turns out to be a wash, with the size of the two implementations being about the same.
By Alice Ryhl
Reference: A Rust implementation of Android's Binder [LWN.net]
"Functions nearly 1,000 lines long are generally a bad sign."
"Ryhl has thus duly rewritten Binder in Rust."
=> Rust in the hands of Ryhl is productive!
In rust, the simple things are possible and complex things are easy
Allegedly from No Boilerplate, via PartisanIsaac2021 on r/rust.