Sat 10 Jul 2021

Inline In Rust

There’s a lot of tribal knowledge surrounding #[inline] attribute in Rust. I often find myself teaching how it works, so I finally decided to write this down.

Caveat Emptor: this is what I know, not necessary what is true. Additionally, exact semantics of #[inline] is not set in stone and may change in future Rust versions.

Source: Inline In Rust, an article by Aleksey Kladov.

Surgical Refactors

Refactoring is like surgery.

That’s not to say that clean refactors save lives. But messy refactors definitely hurt.

A surgeon is economical with their cuts, and refactoring requires the same mindset.

Source: Surgical Refactors, an article by Cameron Hashemi.

Write good examples by starting with real code

When I write about programming, I spend a lot of time trying to come up with good examples. I haven’t seen a lot written about how to make examples, so here’s a little bit about my approach to writing examples!

The basic idea here is to start with real code that you wrote and then remove irrelevant details to make it into a self-contained example instead of coming up with examples out of thin air.

I’ll talk about two kinds of examples: realistic examples and suprising examples.

Source: Write good examples by starting with real code, an article by Julia Evans.