TWiR quote of the week

TWiR 273 had some good reads again!

This one aptly summarizes just how much our consolidation work has paid off!

… the experience I had in 2019 was dramatically better than the first time I touched the language. After a month I’m feeling very comfortable, and looking forward to writing more.

Ryan Ragona on his blog post: Learning Rust in 2019

2 Likes

/u/Quxxy on Reddit:

Can you eli5 why TryFrom and TryInto matters, and why it’s been stuck for so long ? (the RFC seems to be 3 years old)

If you stabilise Try{From,Into}, you also want implementations of the types in std. So you want things like impl TryFrom<u8> for u16. But that requires an error type, and that was (I believe) the problem.

u8 to u16 cannot fail, so you want the error type to be !. Except using ! as a type isn’t stable yet. So use a placeholder enum! But that means that once ! is stabilised, we’ve got this Infallible type kicking around that is redundant. So change it? But that would be breaking. So make the two isomorphic? Woah, woah, hold on there, this is starting to get crazy…

*new person bursts into the room* “Hey, should ! automatically implement all traits, or not?”

“Yes!” “No!” “Yes, and so should all variant-less enums!”

Everyone in the room is shouting, and the curtains spontaneously catching fire. In the corner, the person who proposed Try{From,Into} sits, sobbing. It was supposed to all be so simple… but this damn ! thing is just ruining everything.

… That’s not what happened, but it’s more entertaining than just saying “many people were unsure exactly what to do about the ! situation, which turned out to be more complicated than expected”.

30 Likes

mikesu9: What is the ! type?
LousyBeggar: The never type for computations that don’t resolve to a value. It’s named after its stabilization date.

LousyBeggar, on reddit

37 Likes

A quote on the topic of trust, and by extension, security.

17 Likes

Nobody contributed. Rust started writing itself to avoid human bugs.

Asimov needs a 4th law to #![forbid(unsafe_code)] .

– rat9988 and CUViper on Reddit.

5 Likes

– Rust’s ownership is difficult.
– Yes, ownership is difficult. For such a difficult thing, you (are going to) ever check by hand rather than having machine do it for you.

@Cryolite on Twitter (Japanese)

4 Likes

From normally-aspirated::<fish> on the (unofficial) community discord:

Rust is OOP
Ownership Oriented Programming

17 Likes

“all the ergonomic improvements in rust 2018 are really messing up my book that consists entirely of running face-first into compiler errors so i can explain concepts.” – Alexis Beingessner, author of “Learning Rust With Entirely Too Many Linked Lists”

16 Likes

C++ prevents “thing without pointer” and Rust prevents “pointer without thing”

@RibeiroLivio on twitter

7 Likes
3 Likes

I quite liked TomP’s answer:

One major difference is that Ada was created at a time when most military computers were single-core with in-order sequential execution and no cache. Although limited SIMD existed, any other concurrency was very coarse-grained. That’s the underlying execution model for C, Pascal, C++, etc.

Rust was created to address the complexity of multi-core processors with multi-level cache hierarchies where computational efficiency may require much concurrency. In my experience few humans are capable of error-free design and implementation of highly-concurrent systems unless they employ tooling that flags their errors in conceptualization or implementation.

3 Likes

Confusion is a product type.

—/u/casual-cryptarch on explaining traits and references at the same time

1 Like

Yes, Markdown is like Frankenstein’s monster before applying electricity, and Org-mode is the monster after applying electricity.

-/u/jimuazu in this thread about a parser for Emacs’ Org-Mode format

(not really a quote about Rust, but I found it pretty enjoyable nonetheless)

2 Likes

A compile_fail test that fails to fail to compile is also a failure.

The trybuild README.

14 Likes

Yes, this adds to Rust’s “wierdness budget”, but this is doing it for the right reason: discovering a way to solve a problem that many programming languages have, but few have really tackled.

jcsoo on await syntax (on internals)

7 Likes

The big gorilla 3D game framework. Apparently it actually works.

SimonHeath on Amethyst

1 Like

Never play drinking games with the rust compiler. It will destroy you and show you how sorry of a developer you are!

1 Like

Just the presence of well integrated Algebraic Data Types (ADTs) makes an incredible amount of difference. They are used to represent errors in a meaningful and easy to understand way (Result<T>), are used to show that a function may or may not return a meaningful value without needing a garbage value (Option<T>), and the optional case can even be used to wrap a null pointer scenario in a safe way (Option<Ref<T>> being the closest to a literal translation I think).

That’s just one small feature that permeates the language. Whatever the opposite of a death-of-a-thousand-cuts is, Rust has it.

tomcatfish on “… how (Rust) takes basic concepts from low to high level without bothering me or killing performance…”

6 Likes

Rust attracts people who like challenges.

3 Likes

He’s not pointing in the right direction, but the direction itself is calling!

6 Likes