matklad.github.io
Mar 26, 2022 This post has nothing to do with JIT-like techniques for patching machine code on the fly (though they are cool!). Instead, it describes a cute/horrible trick/hack you can use to generate source code if you are not a huge fan o...
Observations/Thoughts
2022-03-30
~10 min read
matklad.github.io
Mar 14, 2022 I’ve learned a thing I wish I didn’t know. As a revenge, I am going to write it down so that you, my dear reader, also learn about this. You probably want to skip this post unless you are interested and somewhat experienced in...
Rust Walkthroughs
2022-03-16
~7 min read
matklad.github.io
Nov 27, 2021 Unedited summary of what I think a better module system for a Rust-like language would look like. Today’s Rust module system is it’s most exciting feature, after borrow checker. Explicit separation between crates (which form a...
Observations/Thoughts
2021-12-01
~5 min read
matklad.github.io
Sep 4, 2021 It’s common knowledge that Rust code is slow to compile. But I have a strong gut feeling that most Rust code out there compiles much slower than it could. As an example, one fairly recent post says: With Rust, on the other hand,...
Observations/Thoughts
2021-09-08
~20 min read
matklad.github.io
Aug 22, 2021 In this article, I’ll share my experience with organizing large Rust projects. This is in no way authoritative — just some tips I’ve discovered through trial and error. Cargo, Rust’s build system, follows convention over config...
Observations/Thoughts
2021-08-25
~4 min read
matklad.github.io
Jul 9, 2021 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 necessarily what is true. Add...
Rust Walkthroughs
2021-07-14
~4 min read
matklad.github.io
Feb 27, 2021 Click bait title! We’ll actually look into how integration and unit tests are implemented in Cargo. A few guidelines for organizing test suites in large Cargo projects naturally arise out of these implementation differences. An...
Observations/Thoughts
2021-03-03
~4 min read
matklad.github.io
Feb 15, 2021 Hey, I have a short announcement to make: I am joining NEAR (sharded proof of stake public blockchain)! TL;DR: I’ll be spending 60% of my time on WASM runtime for smart contracts and 40% on rust-analyzer. Why NEAR? One of the p...
Miscellaneous
2021-02-24
~1 min read
matklad.github.io
Feb 14, 2021 I’ve been re-reading Ted Kaminski blog about software design. I highly recommend all the posts, especially the earlier ones (here’s the first). He manages to offer design advice which is both non-trivial and sound (a subjective...
Observations/Thoughts
2021-02-17
~7 min read
matklad.github.io
Feb 10, 2021 I want a better profiler for Rust. Here’s what a rust-analyzer benchmark looks like: #[test] fn benchmark_syntax_highlighting_parser() { if skip_slow_tests() { return; } let fixture = bench_fixture::glorious_old_parser(); let (...
Observations/Thoughts
2021-02-10
~1 min read
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