When I last visited my parents, my mom and dad asked me whether I was worried about ChatGPT or other AI systems taking away programmers’ jobs and whether I was worried about my own future. My answer to them—and this might be a naïve take—is that I’m not very worried and that I think that programmers are going to be around for a while yet. The...
A discussion between Jonathan Blow and Casey Muratori on the handling of precedence in Jon’s compiler recently popped in my YouTube feed. The discussion is three hours and focuses on implementing operator precedence more easily and more simply in Jai using Pratt parsing. Jon and Casey also talk about the previous implementation of operator...
When Hare was announced back in 2022, I saw the post on Hacker News, went to the website, looked at the documentation, and my reaction was a lukewarm “meh”. Hare was a new entry in what I call the “Modern Cs”: languages that use C as their base inspiration and try to improve upon C by adding new features, removing some footguns, and polishing...
Most programmers have experienced that feeling of worthlessness and powerlessness when we are trying to implement what should be a simple change, but the existing code base resists our attempts. Worse, often we can see what is causing us to be blocked, yet we cannot bring ourselves to bring down those barriers. I call this the tyranny of existing...
In the talk Solving the Right Problems for Engine Programmers, Mike Acton spends a section of his talk on what he considers the three fundamental areas in which most programmers are incompetent: practice, reasonable defaults, problem solving skills. The first one in particular is quite interesting, because it enables the two others: someone who...
How hard is it to get Minecraft for a game console? If you’re an adult you drive to your favorite video game store, buy Minecraft, pop the cartridge in the console, and play. If you’re a kid, your experience is similar, it has one extra step: you nag your parents for a while to get the game, they drive to the store, buy it, you pop the cartridge...
An article was published in /r/rust a couple weeks ago, Parsing With Nom, a blog post explaining how to use nom to create a parser for a data format in the BitTorrent protocol called Bencode. Nom is a Rust library that provides parser combinators, small functions that provide simple parsing capabilities and which can be combined together to form...
(Intentionally provocative title.) Do you use the word “just”? Have you ever said something like “oh, we just need to implement that interface for this new type” or “it’s just a small bash script” or something to that effect? I have, many times, and still catch myself saying “just” even though I’m trying to exorcise that word out of my...
Many programming books give advice on how we can make our code clean. It seems to be quite a lucrative industry, because these keeping coming out year after year and programmers keep buying them. Unfortunately, these books mostly concern themselves with what the text of the code ought to look like, and not with what the code itself ought to be....
In the last few years, at the end of the year, the Rust Development Team asks people to write blog entries about their wishes for the next year. The new year is still a bit off and no call for such posts has yet been made in 2021, but there are a few things that I have in mind and that I want to write about right now. So without further ados,...
In my last post I made the case that programmers should try and write their software in a way that makes reasonable use of the resources of the computer. By reasonable use, I didn’t mean to try and perform every crazy micro-optimization possible to extract every last speck of performance from the machine: instead, I meant to have mechanical...
The computers sitting on our desks are incomprehensibly fast. They can perform more operations in one second than a human could in one hundred years. We live in an era of CPUs that can perform billions of instructions per second, tens of billions if we take multi-cores into account, of memory that can transfer data to the CPU at hundreds of...
In the past few months, I’ve become interested—fascinated even—by programming fonts. As programmers we look at text all day: code, logs, command outputs, monitoring tools, etc. If we’re going to be looking at text all day, we might as well make it easy and pleasant for our eyes to read that text. One great place to see the fonts used by other...
On September 18th, 2019, Microsoft released a new typeface for coders, Cascadia Code. Cascadia was designed for usage inside Microsoft’s new Terminal application and inside coding editors like VSCode or Emacs. Although it is still just one day old, I thought I’d give my thoughts on Cascadia. The good Microsoft released Cascadia Code under the...
When you choose a font, the most important criteria is “do you like it, and could you stand to look at it for 8 hours per day?” There’s no accounting for taste, so if the short leg of the the letter m in Ubuntu Mono really bugs you, then you should pick a different font and don’t let anyone tell you that you’re wrong. But fonts have...
GNU Parallel1 is a great tool if you want to reduce the running time of a command-line job. Last week, I had a job that took 30+ minutes to run sequentially, but finished in less than two minutes when I ran it with Parallel on a 40-core machine. Unfortunately, GNU Parallel does not have a very intuitive interface and that’s a significant hurdle...
If you’ve not seen Bryan Cantrill talk about software as a reflection of values, let me give you the gist. He argues that there are many desirable values that we can demand in our software (e.g., performance, reliability, approachability). These values, though they are all desirable, are in tension: we can’t have them all at the same time. He...
For one of my projects at work, I thought I could reduce memory usage by storing vectors of sorted integers as vectors of ranges. For example, the vector [1,3,4,5,10,14,15,16,17,18] would be represented by [1, 3..5, 10, 14..18]. (Spoiler: the memory usage was higher because there weren’t enough runs of consecutive numbers to offset the cost of...
A few years ago, I asked on Reddit whether anyone had recommendations for a theme that used only a few colors. I found that too many colors—what many refer to as a Christmas tree—was not helping me understand code better, but in fact was distracting me. I also thought that turning off syntax highlighting entirely was too radical a solution. I...
(This is my response to the call for Rust 2019 Roadmap blog posts.) In 2019, there are three areas where I would like to see the Rust community focus its efforts: Improved compile times A community effort to review crates More “80% solutions” Improved compile times I already wrote about compile times in Rust (see Rust at Work—Two Paint Points and...
Before I became an Emacs user, I was a vi user, and though Emacs is my primary editor, I still use vi daily. I use vi for quickly skimming the content of a file and quick edits to configuration files; I use vi when I’m on a remote server or when a command-line utility invokes $EDITOR. The main reason why I still use vi is because I’m able to use...
Today I released ppbert 0.8.4 after I read a comment on Hacker News that made me leap out of my chair: buffering StdoutLock improves the performance of IO-bound programs! Previously, I thought that doing stdout.lock() was sufficient. Oops! This release also marks the first time that one of my original test files can be pretty printed in less than...
A few days ago, I wrote about two Rust pain points when using Rust at work. One of these points were the long compile times. In this post, I want to share a few tips that can help alleviate that pain. Use cargo check We typically use the compiler for two reasons: to verify if the syntax and/or types are correct and to generate a runnable program....
The 2018 State of Rust Survey asks the following question: How could we help make Rust more accepted at your company? We use Rust in three projects at work, and the two primary concerns for people are (1) the crates ecosystem, and (2) compile times. I gave some details in my answer to the survey, and I want to expand on those two points here. The...
Emacs 26.1 was released this week and I thought I’d use the occasion to write a quick post about the main reason why I stick to Emacs: consistency. Happily, I realized that this reason applies to other text editors as well. I use Emacs for programming; whether it’s Rust, C, Erlang, Python, or bash scripts, Emacs is the editor I choose. For any...
ppbert has improved since the last time I wrote about it: I’ve done more work to improve the speed of pretty-printing; the large .bert file that took 3 seconds to process in Februrary now takes 1.5 seconds. I’ve added binary artifacts to releases — binaries for ppbert and bert-convert that are statically-linked against musl. You should be able to...
I had an itch: I was pretty-printing the BERT-encoded terms that we use in a production system at work and it was very slow. The Erlang shell took more than two minutes to dump the largest file. (It took about 0.1 second to read and parse the file; the rest was spent in io:format.) I decided to scratch that itch: I wrote ppbert, a command-line...
I just retired my first good, semi-successful fort in Dwarf Fortress. I decided jot down a few comments while the memories are still fresh. My fort, Commonbread, lasted 6+ years, survived 4 goblin sieges, had 150 dwarfs at its peak, and generated more than ☼1.6M in value. Main mistakes My two principal mistakes are related: I picked a cold embark...
A new version of Dwarf Fortress was released last week, and it was all the incentive I needed to start playing again. I suck at DF, but I love that game: it savantly combines depth and complete wackiness and the old-school look-and-feel certainly appeals to me. Yet, I think that the game has (at least) one huge flaw: its menu system makes ed(1)...
The top comment by /u/staticassert in a Reddit thread on type systems makes an interesting point, one that I made in the past myself: what is a type error? I read those types (pun intended) of threads often enough, and one recurring argument often made by people who doubt the benefits of type systems goes like this: “I rarely make errors that the...
I am on vacation this week, so I decided to dig out a backtracking Sudoku solver I wrote last summer and see what I could do to improve its performance. A couple of changes to the data structures and the algorithm yieled an important speed-up. Previously, I had used a BTreeSet to store the list of candidates for a cell; I now use a u32 to...
Now that I have a slightly more powerful computer, I was finally able to play through The Talos Principle and its DLC, The Road to Gehenna. [Spoilers below] The gameplay is mostly about solving problems by using some items. You have jammers that can open doors, disable bombs and guns; boxes to hold down buttons and to increase the height of an...
At AdGear, the developers typically end their week at “Friday Not Friday”, a team activity from 4pm to 5pm. One person gives a presentation on any technical subject while the others listen and sip a beer to wind down before the week-end. Last week, I gave a demonstration that I called “Speedrunning a Compiler”. I wanted to show my colleagues the...
The purpose of syntax highlighting is to draw attention to certain parts of the code: it helps us to identify when a comment or a string literal is not properly terminated, when a keyword is misspelled, or when an escape sequence is invalid. Lately, I find that editors colorize too many elements and use too many colors. (This is a...
First-in first-out queues are a data structure used in many algorithms (including my favorite one—breadth-first search) and as a building block for complex functionality, the operations on queues should be as efficient as possible. This can be a bit of a challenge in a functional language: the bread-and-butter data structure of functional...
Being a teaching assistant is a job that most graduate students are asked—pressured even—to do. During my time at McGill, I was a T.A. three times: twice for the introduction to compiler design class (taught by my adviser), and once for a functional programming class. It was difficult, time-consuming, and not well paid, yet being a T.A. was the...
I recently purchased Journalistic Writing by Robert Knight. I’m not a journalist, but I’m sure some of his lessons transfer to other areas of non-fiction writing. At the end of the first chapter, the author presents the reader with a number of sentences that contain unneeded thats, there is’s, there are’s, etc.; the goal of the exercise is to...
En août dernier, j’ai utilisé mon premier chèque de paie pour m’offrir un abonnement au journal Le Devoir. Ça fait maintenant 6 mois que je le lis plus-ou-moins quotidiennement (ces jours-ci, je passe plus de temps à lire sur la situation politique aux États-Unis) et c’est un 17$ par mois très bien investi selon moi: je suis mieux informé...
Recursion is my absolute favorite programming technique. It’s powerful, it’s elegant, and for many problems it yields simple and beautiful solutions. Unfortunately, recursion has a terrible reputation: new programmers find it hard and unnatural and some programmers with years of experience avoid it because of the trauma it incurred when they...
Can you point to a book that changed your outlook on life and had a profound impact on the kind of person you are? For me, that book would be Learning Red Hat Linux. In 1997, I was 14 and I decided that I wanted to be hacker. In order to look the part, I wanted to install Linux on my computer. This was early in Linux’s life and the distributions...
En septembre dernier, j’ai reçu une lettre qui me convoquait à la cours de Montréal pour servir comme candidat-juré. Je ne savais pas du tout comment le processus fonctionnait et quand je suis arrivé au Palais de Justice, j’ai réalisé que la majorité des gens présents étaient également ignorants du processus. J’ai pris des notes durant mes deux...
During the month of December, I completed all the Advent of Code problems using a programming technique called Literate Programming (LP). My programs look like LaTeX documents, they mostly contain text that explains the task at hand and details my solution, and they are interspersed with Rust code that gradually builds the solution. The build.sh...
Final Fantasy IV is a fantastic game, and Final Fantasy IV Advance is a fine port plagued by an unforgivable flaw. Final Fantasy IV was released in North America as Final Fantasy II; the US port was modified to be an easier game. Enemies had fewer hit points and the characters had fewer abilities, like Cecil who didn’t have his Darkness attack....
Following my playthrough of the original Final Fantasy for the NES, I played the remake for the Gameboy Advance, Final Fantasy I: Dawn of Souls. The game wasn’t very hard, and since I knew exactly what I had to do, I didn’t wander around aimless and was able to finish it in roughly nine hours. The port to the GBA includes modernized graphics,...
A week ago, I finished my first playthrough of the original Final Fantasy for the NES. In the past, I had not been super interested in playing this episode since it was said to be (understandably) rough around the edges, being the first entry in the franchise. A few factors changed my mind: first, I heard great comments on the FF1 run at AGDQ...
I used to have a blog, a long time ago, where I’d sometimes write incoherent ramblings about coding, politics, and any other subject that struck my fancy. After a long hiatus, let’s get going again!