Casey Muratori | Smart-Pointers, RAII, ZII? Becoming an N+2 programmer
Why Hacker News recommends it
HN commenters in memory management and language design threads cite it as the best explanation of group lifetimes versus per-object ownership.
What it is
Casey Muratori argues against smart pointers and RAII, advocating grouped-element thinking, zero-is-initialization and stubs as better ways to structure memory and handle errors.
Recommended by 6 HN commenters across 6 different months, 2024 to 2026.
What Hacker News said
Strong rec bsder · 2024-09 · on “Committing to Rust in the Kernel”
C and C++ are very different. I think Casey Muratori hits the nail on the head here: [this video] In short, RAII and smart pointers and borrow checker are all signs of "individual element thinking" and that way lies madness. You smear out lifetime and ownership so badly that it practically by definition becomes a problem. Your goal is to think about this stuff in groups to make thinking about allocation way, way easier. Programming is all about abstracting to the next layer. I'm not sure he has quite gotten to the heart of the issue, yet. However, a bunch of smart people (Casey Muratori, Jonathan Blow, Andrew Kelley, etc.) are all dancing around something that Rust and C++ don't seem to fit the b
Strong rec gingerBill · 2026-01 · on “Odin: Moving Towards a New "core:OS"”
Unfortunately I don't think you've understand what I was I trying to say. Rust was designed from day-0 around explicit individual-value based initialization. Odin from day-0 was not designed around this (explicitly). This ever so minor choice might not seem like a big thing to you, as you have stated in your comment, but it leads to MASSIVE architectural decisions later on when the user programs. Odin could not "just add" non-nil pointers and it be "fine". It would actually not be Odin any more, and the entire language would not even be a C alternative any more, and feel much more like C++ or Rust. Rust and OCaml (which Rust is based off) are different kinds of languages to Odin and their ap
Strong rec jackclayton · 2026-07 · on “Claude Code uses Bun written in Rust now”
Above poster is talking about thinking in terms of grouped lifetimes and bulk allocations/deallocations, which is better for performance, and makes Rust borrow checking and other RAII style features completely pointless as they don't add any safety benefits. I used to think like you until I watched this video: [this video] I can confirm after exploring programming like the above video explains, that everything he says is completely true.
Recommends slowmovintarget · 2025-05 · on “Odin: A programming language made for me”
Here's Casey Muratori on his habit of moving to ZII: [this video] Much better outcomes and failure modes than RAII. IIRC, Odin mentions game programming as one of its use cases.
Recommends gingerBill · 2025-05 · on “Odin: A programming language made for me”
> It seems to me... that initialization time is unlikely to be significant The thing is, initialization cost is a lot more than you think it is, especially when it's done on a per-object level rather than a "group" level. This is kind of the point of trying to make the zero value useful, it's trivially initialized. And in languages that are much more strict in their approach, it is done at that per-object level which means instead of the cost of initialization being anywhere from free (VirtualAlloc/mmap has to produce zeroed memory) to trivially-linear (e.g. memset), to being a lot more nested hierarchies of initialization (e.g. for-loop with constructor for each value). It's non-obvious why
Recommends thegeekpirate · 2025-12 · on “Zig's new plan for asynchronous programs”
There's a GC library around somewhere, but I doubt anyone uses it. Manual memory management is generally quite simple, as long as you aren't using archaic languages. [this video] is worth a watch.
Recommends ChrisTrenkamp · 2026-05 · on “Bun ported to Rust in 6 days”
This is a hot take, but programming languages haven't progressed since the 90's. We've been conditioned to believe that if you want to be a serious programmer, you have to either use C++-style RAII (which includes Rust), or garbage collection, and there's no in-between, and C programmers are dinosaurs who can be ignored. Arena allocators are a great way to automatically manage memory allocations. You malloc a whole bunch of memory and release it all with a single free, which makes it much easier to reason about your program's memory safety. Casey Muratori has a good video talking about this. [this video] And about Zig, you have an Arena Allocator out of the box: [LINK] . And it's not just limited
Cites budro · 2025-01 · on “Show HN: Uscope, a new Linux debugger written from scratch”
> And this is where Rust differs; Rust will reduce the likelihood of bugs from happening in the first place. I'm not saying Zig doesn't also do that, Rust just does it more. I'd argue that it does this a LOT more. When it comes to spatial safety, Rust and Zig are on par. However in terms of temporal safety I think Zig lags far behind Rust... along with basically every other compiled systems language. If you had to come up with a single good reason to use Rust over Zig, it would definitely be temporal safety. A majority of applications don't need this though, or can be designed such that they don't. One of my main issues with Rust is that it makes it easy to write spaghetti code that uses ref