TWiR quote of the week

...then go sleep and find your code correct and working in the morning

Woah, I know people say the Rust compiler is slow but I never had a Rust program that took all night to compile

i nominate the above exchange between @dunnock and @ZiCog.

7 Likes

About how mod are handled in rust macro : https://internals.rust-lang.org/t/crate-dependency-discovery/11418/4

2 Likes

...with the proviso that the first quote should be extended to make it clear that the second one is a tongue-in-cheek intentional misinterpretation of something that's originally talking about coding while not in full command of your faculties.

6 Likes

When I'm writing in Rust, it feels as though I'm actually able to think about the program, rather than wasting half of my effort going through the necessary rituals to stop the language from having a panic attack.
-- /u/rime-frost @ https://www.reddit.com/r/rust/comments/e8tms0/rust_is_fun/faei257/

6 Likes

James Munns:

Hey @rustlang folks, is there a comprehensive writeup/reference anywhere of how the formatting machinery (format!(), write!(), etc.) work? Specifically from an implementation perspective (wrt trait objects, recursion)?

nrc:

It’s dark and ancient magic. I don’t think anyone knows it very well, never mind documentation


grafik

as highlighted in James Munns's blog post https://jamesmunns.com/blog/fmt-unreasonably-expensive/

7 Likes

I kinda wish I could forbid arithmetic operators in my crates.

Monadic Cat, in a conversation about fuzzing

3 Likes

So, I'd say writing Rust without GAT is just like eating scrambled eggs without egg yolk, something is left to be satisfied.

@rui in

3 Likes

Not about Rust directly, but the nice thing around it:

...in Rust there's a contract that if your function is marked as safe, it's must be impossible to misuse it for unsafe things even if you give your API to an infinite number of monkeys with keyboards.

@kornel in

8 Likes

I don't know if this is necessarily a good candidate for quote of the week but the discourse is pretty funny. Here is the thread on HN.

2 Likes

Rust keeps us safe and sound :smiley:

5 Likes

To be clear, you are suggesting:

#[non_exhaustive]
    https://www.rust-lang.org/production/users

right?

Regardind the unsafe vs. unsound distinction (in rust):

  • Lo bueno, si breve, dos veces bueno (what['s] good, when brief, [is] twice [as] good) :ok_hand:
14 Likes

On the first day of Christmas, my language gave to me A thought to make the software more free!

by @BatmanAoD

2 Likes

Coding in C is like camping. It's fun for a while, but eventually you really miss things like flushing toilets and grocery stores. I like using C, but I get frustrated every time I hit a wall trying to build features from other languages. C is a very WET language.

From https://news.ycombinator.com/item?id=21884449

7 Likes

Sorry it took a while to respond. I though the parent comment and that comment were funny. Since this feature was just released it seemed appropriate.

from After a week with Rust, slightly edited for spelling/grammar/punctuation

9 Likes

relatively speaking , my rust programs are like Leonardo DiCaprio in the Revenant, killing grizzly bears with their bare hands, dying and being frozen into a giant ice cubes then, surprise!, they're actually alive.

they can handle a lot, they tend to experience far fewer bugs that come around days or weeks after going into production.

my python programs, otoh, are like William Henry Harrison. Inauguration day! exciting! kind of chilly out here. uh oh -- pneumonia ... dang it!

from a conversation on reddit by jstrong.

5 Likes

I wouldn't nominate that as a great quote, because, to be frank, "less expressive" is a terrible formulation. It has a strong negative connotation while also missing the point, which apparently stems from the confusion between "expressiveness" and the number of features or the ability to transliterate code from $LANGUAGE. That is counter-productive when e.g. trying to market (or even just objectively describe) the language.

"Stricter" in order to protect the programmer from themselves? Yes. "Less expressive?" Not at all. It's perfectly possible to do just about anything in Rust that is possible in existing general-purpose languages, just not how it is usual elsewhere. Indeed, Rust has no inheritance or garbage collection or reflection or overloading (or …). But one can solve the same problems by other, more principled means, and often more elegantly so than whatever the equivalent in another language would look like. (Rendering Rust more, rather than less, expressive in my eyes.)

Expressiveness is a high-level concept; it's about the spectrum of problems to solve or goals to achieve. It is not about low-level details (such as "I can't make two mutable pointers to the same value").

Why not just propose a different, improved-from-your-perspective formulation of the ideas in the quote, whose purpose clearly is to point out that approaches that work in other languages very often don't work in Rust, but that problems that seem to be#1 solveable in other languages, albeit unsafely, can be solved completely safely in Rust. In other words, "Hack without fear."

#1 "seem to be", because often such solutions are not actually solved correctly in C/C++/etc.