I was going to submit a quote, but Amos's quote is going to win anyway
Amos also has an updated quote (rolls off the tongue slightly better imo) on the followup blog post:
And you can write logic errors in just about every language! And if you try hard enough I'm sure you can drive a train straight into a tree! It's just much easier with a car.
My preferred response to this argument goes like this:
Edit: nvm... Somebody already got here first: TWiR quote of the week - #1219 by crumplecup
I'd like to stretch up a bit the concept of "quote" for TWiR and use a portion of a video. I'll include a transcript after it (if I manage to get everything right).
So, nothing is taken from Rust, by the way, because Rust is very close to being the perfect language. And Rust's borrow checker (and lifetime checker and all this other stuff) they make your life very difficult. But the reason they're making life very difficult is because the things you are trying to do are really, really bad and you shouldn't be doing them, and they have the potential to cause your program to crash and do unexpected things.
And Rust knows this and it is not going to let you do these things. But if you haven't tried Rust, just grab it and work through the first couple of chapters of the Rust book and do something wrong, because the error messages in Rust... it's like a hug form the compiler. It's just "There, there. You did your best. Yes, yes. No, you see here where you've done this? No, you can't do that. No, no, i'ts bad. No, what you probably wanted to do was..." It teaches you Rust. The compiler. It's lovely.
The shorter version of a quote I believe would best be:
[...] if you haven't tried Rust, just grab it and work through the first couple of chapters of the Rust book and do something wrong, because the error messages in Rust... it's like a hug form the compiler. It's just "There, there. You did your best. Yes, yes. No, you see here where you've done this? No, you can't do that. No, no, i'ts bad. No, what you probably wanted to do was..." It teaches you Rust. The compiler. It's lovely.
This video has already been brought up two times.
I liked this quote:
I also liked this quote:
It doesn't matter who points out that "maybe we shouldn't hit ourselves in the head with a rake repeatedly": that feedback ought to be taken under advisement no matter who it comes from.
...I believe this general pattern - [Generic Associated Types] as a way to generically define an operation with types known only to the implementation - is generally useful for a lot of code, as is visible in existing languages with GATs/HKTs. Where Rust really hits the ball out of the park is that it guarantees monomorphisation, allowing these patterns to be truly zero-cost. It's difficult to overstate just how powerful that is.
Sorry for the spam, I keep finding things I want to post
At Cloudflare we have big Rust projects/teams and onboard new developers regularly.
There is a learning curve. Rust is rigid and unforgiving, and noobs need assistance when the compiler says “no” (although error messages and Clippy do a good job for common mistakes).
However, the big upside is that noobs can contribute safely to Rust projects. Rust limits severity of the damage an inexperienced programmer can cause. Once they manage to get the code to compile, it already has lots of correctness guarantees. “Bad” Rust code may just
clonemore than strictly necessary, or write 10 lines of code for something that has a helper method in the stdlib, but it won’t corrupt memory or blindly run the happy path without checking for errors. Rust prefers to be locally explicit, so it’s also easy to review.
This is where I am. Like for real 100%
Is kornel reading my code?
I have no idea why this comment was deleted. It should be:
The only dynamic language I truly like is Clojure and a large part of that is because the deep immutability constrains state interactions across the system. I found it to be reliable but the pain of major refactors means it’s not something I advocate for on the job. I used to think you had to have that immutability to get the control benefits but Rust’s immutable by default and single writer rule enforced by the compiler achieves most of the practical benefits with much lower runtime overhead.
I’m finding that the majority of my time goes into writing straightforward business logic and refactoring tests, for which Rust doesn’t get in the way. It’s only during certain parts of the project’s lifetime that I’ve had to build the foundations (abstractions, layering, async constructs, etc.) or done large redesigns, and it’s only during those times that I’ve had my fights with Rust.
In other words: given a sufficiently large project or team, and irrespective of the language, there will always be a set of core maintainers that design, write and maintain the foundations. This set of people knows the ins and outs of the project and should know the ins and outs of the language and its ecosystem. This set of people is necessary . But once these foundations are in place, all other contributors can focus on the exciting aspects of building features. Rust’s complexities may still get in the way, but not much more than those of other languages.
By Julio Merino in Rust is hard, yes, but does it matter?.
I like the option to have both a foot gun as well as a foot harpoon in the same project.
-- ridicalis @ https://www.reddit.com/r/rust/comments/unmdsn/multiparadigm_in_c_is_bad_actually/i8bu6od/
At least have the footgun and foot harpoon be designed by the same person with a holster that was designed to hold both!
-- thecodedmessage @ https://www.reddit.com/r/rust/comments/unmdsn/multiparadigm_in_c_is_bad_actually/i8bvv93/
(A conversation on thecodedmessage's latest post on C++ vs. Rust. More specifically, how C++ is more or less three independently designed languages in one, each from a different era of thought, for lack of Rust's focus on tools like Editions.)
It is worth remembering that there is an infinitely large set of programs but a very small set of useful programs. A programming language is a form of ad-hoc compression algorithm, it is intended to sort the set of useful programs to have shorter encodings than the undesirable ones. Programs with certain categories of error or security vulnerability should be harder or impossible to express.
david_chisnall on lobste.rs.
Rust takes Python's 'explicit is better than implicit' to the next level, almost to the extreme!
This is the difference in approaches of the two languages. In C++ if the code is vulnerable, the blame is on the programmer. In Rust if the code is vulnerable, Rust considers it a failure of the language, and takes responsibility to stop even “bad” programmers from writing vulnerable code. I can’t stress enough how awesome it is that I can be a careless fool, and still write perfectly robust highly multi-threaded code that never crashes.
kornel on lobste.rs (again)
I have to raise a little red flag on the above quote least other are led astray with a false sense of security.
When one says software is "vulnerable" that is usually in the context of security. Basically trying to stop bad actors from using systems in bad ways.
Whilst Rust certainly enforces lots of rules to help reduce silly coding errors that introduce memory use and other silly mistakes and whilst that prevents a lot of bugs that could cause security issues it does not ensure ones code does not have security vulnerabilities.
If Rust code contains security vulnerabilities, for example an incorrectly implemented encryption system, the programmar cannot blame the language or compiler for it.
In C everybody’s gangsta until someone dereferences a pointer.