TWiR quote of the week

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

8 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.

imagine a From<[u8]> for SHA-512, rust automatically impls a quantum computer to find all inputs that result in that hash :^)

seri in #beginners on official discord server.

Context: the OP in the question confused the complementary auto traits (from & into) and thought that From<T> for U automatically implements Into<T> for U instead of Into<U> for T

4 Likes

In response to community flagging this post as 'inappropriate', I've decided to withdraw this post.

However, to give context to @ZiCog's reply below, and for historical records, I'm keeping the link to Twitter where original quote can be found.

quote on Twitter

3 Likes

nasa42,

I don't think talking of variety of often erotic practices or roleplaying involving bondage, discipline, dominance and submission, sadomasochism, and other related interpersonal dynamics.

is appropriate for a family friendly technical forum.

4 Likes

The original poster probably just meant that learning to program in Rust can seem to be an exercise in masochism.

7 Likes

i never knew the compiler was a furry

@cyber in the community discord

In response to What to say to a C programmer when they say

5 Likes

@ZiCog: Does anyone have a 'no holds barred, unsafe or not' solution to the problem in Rust that can match C?
@kornel: Pipe the C version through c2rust :slight_smile:
@ZiCog: Yay! Rust now beats both Clang and GCC!

4 Likes

Generic types describe ranges of types, just like types describe ranges of values, and traits are to generic types what properties are to structs. So a new trait actually defines a new type of types, and can be combined with other traits to form a hierarchy of traits.

@mankinskin in Suggestion for making Rust's trait system more usable for generics

1 Like

14 posts were split to a new topic: Traits as types of types

But I know one thing: I certainly wouldn't implement a new version control tool in Python 3 and I would probably choose Rust as an implementation language for most new projects in the systems level space or with an expected shelf life of 10+ years

From: Mercurial's Journey to and Reflections on Python 3

5 Likes

At a previous job, two of us spent a full week of 8 hour days chasing down a memory error (in a C++ codebase). It took about ~2-5 hours to reproduce the random crash each time, at which point, the traces we got back were so mangled due to memory overwrites, all we could do was add printlns to slowly narrow down the problem. In the end, it was something like a pointer that wasn't nulled out correctly.

With all the times the Rust compiler screamed at me so far, I don't think it has added up anywhere close to 80 hours yet. And that was just one bug.

So either the compiler screams at you, or you end up wanting to scream at each other...
-- /u/minibuster @ https://www.reddit.com/r/rust/comments/epo0t9/even_with_the_no_of_times_rust_compiler_screams/fekohey/

8 Likes

from Closure `impl Fn` performance

I just have to suggest it, since I'd never thought of referring to godbolt as "god".

4 Likes

Is it acceptable to nominate our own quotes? ...because I just stumbled upon a metaphor which I think has a shot at this.

1 Like

Sure. Why not? :sweat_smile: People nominate their own crates.

In that case,

[Three paragraphs of analogy about knife-juggling]

Heck, if anyone wants to try that for a less divisive candidate for Quote of the Week, here's a more quotable formulation:

Programming is like juggling. Memory-unsafe programming is like juggling knives. Proper use of the unsafe keyword is forcing audience members to climb onto the stage in full view of the juggler before they get into range of the knives.
-- /u/ssokolow @ https://www.reddit.com/r/rust/comments/eq1ddn/regarding_nikolay_actixweb_and_the_rust/fep1o6r/

2 Likes