matklad.github.io
Sep 19, 2026 Are generative (randomized) tests significantly more effective than example-based unit-tests at discovering bugs? There’s an interesting discussion about this on lobste.rs. One argument in favor of unit tests is, paraphrasing M...
Rust Walkthroughs
2026-09-23
~11 min read
matklad.github.io
matklad.github.io Topics: IDE development, compilers, rust-analyzer internals, build systems Why RustGrep includes it: rust-analyzer origin. IDE and compiler design. Categories: crate-author, compiler
Blog
2026-07-27
~1 min read
matklad.github.io
On Ousterhout’s Dichotomy Oct 6, 2024 Why are there so many programming languages? One of the driving reasons for this is that some languages tend to produce fast code, but are a bit of a pain to use (C++), while others are a breeze to writ...
Observations/Thoughts
2024-10-09
~3 min read
matklad.github.io
Sep 24, 2024 In these two most excellent articles, https://without.boats/blog/let-futures-be-futures and https://without.boats/blog/futures-unordered, withoutboats introduces the concepts of “multi-task” and “intra-task” concurrency. I want...
Rust Walkthroughs
2024-09-25
~18 min read
matklad.github.io
Jul 5, 2024 There’s a fascinating Rust library, loom, which can be used to thoroughly test lock-free data structures. I always wanted to learn how it works. I still do! But recently I accidentally implemented a small toy which, I think, con...
Observations/Thoughts
2024-07-10
~23 min read
matklad.github.io
Dec 10, 2023 Ever since reading What If We Pretended That a Task = Thread? I can’t stop thinking about borrowing non-Sync data across .await. In this post, I’d love to take one more look at the problem. Send And Sync To warm up, a refresher...
Observations/Thoughts
2023-12-13
~11 min read
matklad.github.io
Nov 15, 2023 A short note on two related rules of thumb. Push Ifs Up If there’s an if condition inside a function, consider if it could be moved to the caller instead: // GOOD fn frobnicate(walrus: Walrus) { ... } // BAD fn frobnicate(walru...
Observations/Thoughts
2023-11-22
~3 min read
matklad.github.io
May 21, 2023 In this tutorial, I will explain a particular approach to parsing, which gracefully handles syntax errors and is thus suitable for language servers, which, by their nature, have to handle incomplete and invalid code. Explaining...
Rust Walkthroughs
2023-05-24
~30 min read
matklad.github.io
Apr 9, 2023 More or less the title this time, but first, a story about SIMD. There are three levels of understanding how SIMD works (well, at least I am level 3 at the moment): Compilers are smart! They will auto-vectorize all the code! Com...
Observations/Thoughts
2023-04-12
~11 min read
matklad.github.io
Mar 26, 2023 This post will be a bit all over the place. Several months ago, I wrote Hard Mode Rust, exploring an allocation-conscious style of programming. In the ensuing discussion, @jamii name-dropped TigerBeetle, a reliable, distributed...
Observations/Thoughts
2023-03-29
~13 min read
matklad.github.io
Mar 28, 2023 In my last post about Zig and Rust, I mentioned that Rust is a “scalable language”. Let me expand on this a bit. Vertical Scalability Rust is vertically scalable, in that you can write all kinds of software in it. You can write...
Observations/Thoughts
2023-03-29
~2 min read
matklad.github.io
Jan 25, 2023 In Rust in 2023, @nrc floated an idea of a Rust compiler rewrite. As my hobby is writing Rust compiler frontends (1, 2), I have some (but not very many) thoughts here! The post consists of two parts, covering organizational and...
Observations/Thoughts
2023-02-01
~5 min read
matklad.github.io
Rust’s Ugly Syntax Jan 26, 2023 People complain about Rust syntax. I think that most of the time when people think they have an issue with Rust’s syntax, they actually object to Rust’s semantics. In this slightly whimsical post, I’ll try to...
Miscellaneous
2023-02-01
~4 min read
matklad.github.io
Jan 4, 2023 This is a short post which decomposes “random numbers” topic into principal components and maps them to Rust ecosystem. True Randomness For cryptographic purposes (eg, generating a key pair for public key cryptography), you want...
Observations/Thoughts
2023-01-11
~3 min read
matklad.github.io
May 31, 2021 Alternative titles: Unit Tests are a Scam Test Features, Not Code Data Driven Integrated Tests This post describes my current approach to testing. When I started programming professionally, I knew how to write good code, but go...
Observations/Thoughts
2023-01-04
~21 min read
matklad.github.io
Nov 18, 2022 A well-known pitfall when implementing a linked list in Rust is that the the default recursive drop implementation causes stack overflow for long lists. A similar problem exists for tree data structures as well. This post descr...
Observations/Thoughts
2022-11-23
~4 min read
matklad.github.io
Oct 6, 2022 This post is a case study of writing a Rust application using only minimal, artificially constrained API (eg, no dynamic memory allocation). It assumes a fair bit of familiarity with the language. Hard Mode Rust The back story h...
Observations/Thoughts
2022-10-12
~19 min read
matklad.github.io
Jul 10, 2022 This is going to be a philosophical post, vaguely about language design, and vaguely about Rust. If you’ve been following this blog for a while, you know that one theme I consistently hammer at is that of boundaries. This artic...
Observations/Thoughts
2022-07-13
~7 min read
matklad.github.io
Jun 11, 2022 In this post I’ll describe how to implement caches in Rust. It is inspired by two recent refactors I landed at nearcore (nearcore#6549, nearcore#6811). Based on that experience, it seems that implementing caches wrong is rather...
Rust Walkthroughs
2022-06-15
~6 min read
matklad.github.io
May 29, 2022 In this short post, I describe and name a cousin of the builder pattern — builder lite. Unlike a traditional builder, which uses a separate builder object, builder lite re-uses the object itself to provide builder functionality...
Rust Walkthroughs
2022-06-01
~2 min read