matklad.github.io
Dec 28, 2020 This post documents call site dependency injection pattern. It is a rather low level specimen and has little to do with enterprise DI. The pattern is somewhat Rust-specific. Usually, when you implement a type which needs some u...
Observations/Thoughts
2020-12-30
~4 min read
matklad.github.io
Dec 12, 2020 Rust’s libs teams is considering overhauling std::sync module. As a part of this effort, they are launching lock poisoning survey. https://blog.rust-lang.org/2020/12/11/lock-poisoning-survey.html This is post is a an extended r...
Observations/Thoughts
2020-12-16
~4 min read
matklad.github.io
Oct 15, 2020 In this article we’ll dissect the implementation of std::io::Error type from the Rust’s standard library. The code in question is here: library/std/src/io/error.rs. You can read this post as either of: A study of a specific bit...
Observations/Thoughts
2020-10-21
~8 min read
matklad.github.io
Oct 3, 2020 Rust thread-locals are slower than they could be. This is because they violate zero-cost abstraction principle, specifically the “you don’t pay for what you don’t use” part. Rust’s thread-local implementation( 1, 2 ) comes with...
Observations/Thoughts
2020-10-07
~5 min read
matklad.github.io
I’ve recently read an article criticizing Rust, and, while it made a bunch of good points, I didn’t enjoy it — it was an easy to argue with piece. In general, I feel that I can’t recommend an article criticizing Rust. This is a shame — conf...
Observations/Thoughts
2020-09-23
~7 min read
matklad.github.io
Sep 13, 2020 This post describes my own pet theory of programming languages popularity. My understanding is that no one knows why some languages are popular and others aren’t, so there’s no harm done if I add my own thoughts to the overall...
Miscellaneous
2020-09-16
~4 min read
matklad.github.io
Sep 12, 2020 This is my response for this year’s call for blog posts. I am writing this as a language implementor, not as a language user. I also don’t try to prioritize the problems. The two things I’ll mention are the things that worry me...
Call for Blog Posts
2020-09-16
~13 min read
matklad.github.io
Aug 15, 2020 This is a hand-wavy philosophical article about programming, without quantifiable justification, but with some actionable advice and a case study. Suppose that there are two types in the program, Blorb and Gonk. Suppose also th...
Observations/Thoughts
2020-08-18
~4 min read
matklad.github.io
Aug 12, 2020 This is a short note on the builder pattern, or, rather, on the builder method pattern. TL;DR: if you have Foo and FooBuilder, consider adding a builder method to Foo: struct Foo { ... } #[derive(Default)] struct FooBuilder { ....
Learn Standard Rust
2020-08-18
~1 min read
matklad.github.io
Jul 15, 2020 This is a short ad of a Rust programming language targeting experienced C++ developers. Being an ad, it will only whet your appetite, consult other resources for fine print. First Program fn main() { let mut xs = vec![1, 2, 3];...
News & Blog Posts
2020-07-21
~2 min read
matklad.github.io
Apr 15, 2020 This is a sequel to the previous post about Pratt parsing. Here, we’ll study the relationship between top-down operator precedence (Pratt parsing) and the more famous shunting yard algorithm. Spoiler: they are the same algorith...
News & Blog Posts
2020-05-05
~18 min read
matklad.github.io
Apr 15, 2020 This is a sequel to the previous post about Pratt parsing. Here, we’ll study the relationship between top-down operator precedence (Pratt parsing) and the more famous shunting yard algorithm. Spoiler: they are the same algorith...
News & Blog Posts
2020-04-21
~18 min read
matklad.github.io
Apr 13, 2020 Welcome to my article about Pratt parsing — the monad tutorial of syntactic analysis. The number of Pratt parsing articles is so large that there exists a survey post :) The goals of this particular article are: Raising an issu...
News & Blog Posts
2020-04-14
~22 min read
matklad.github.io
Mar 22, 2020 This post describes a simple technique for writing interners in Rust which I haven’t seen documented before. String interning is a classical optimization when you have to deal with many equal strings. The canonical example woul...
News & Blog Posts
2020-03-24
~7 min read
matklad.github.io
Feb 14, 2020 ... by me? Rust is my favorite programming language (other languages I enjoy are Kotlin and Python). In this post I want to explain why I, somewhat irrationally, find this language so compelling. The post does not try to explai...
News & Blog Posts
2020-02-18
~10 min read
matklad.github.io
Jan 4, 2020 (at least on commodity desktop Linux with stock settings) This is a followup to the previous post about spinlocks. The gist of the previous post was that spinlocks have some pretty bad worst-case behaviors, and, for that reason,...
News & Blog Posts
2020-01-07
~10 min read