Tags: lifetime

So, you want to write an unsafe crate

2024-04-29  9 minute read

These days saw the release of nolife 0.4, a crate that offers an intuitive fix for borrow errors by letting you conveniently store a scope of execution containing multiple borrows inside of your struct without a lifetime. I want to seize this opportunity to write a bit about what goes into making a library that juggles self-referential code like nolife does.

A curiously recurring lifetime issue

2023-12-15  8 minute read

Naming is hard. After all, it is one of the two hard problems of computer science, with cache invalidation and off-by-one errors.

Mostly we would assume that poorly chosen type and variable names would merely make the code harder to read, but turns out they can lead to undefined behaviour, too. And no, I'm not talking about the reserved identifiers in C (I mean, who would use _Foo or __init__ as identifiers? Nonsense!), but rather something a bit more subtle.