RSSAmplifier

Blog

James Fennell

Recent content on James Fennell

jpfennell.comRSS feed ↗5 posts

Latest posts

A surprising enum size optimization in the Rust compiler

Enums are one of the most popular features in Rust. An enum is type whose value is one of a specified set of variants. /// Foo is either a 32-bit integer or character. enum Foo { Int(u32), Char(char), } Values of type Foo are either integers (e.g. the variant Foo::Int(3) with a payload of 3) or characters (e.g. the variant Foo::Char('A') with a payload of 'A'). If you think of structs as being the…

Migrating Transiter from Python to Go

Transiter is a backend web service that subscribes to transit data feeds and provides an HTTP API for querying the data (e.g., “when are the next trains at Times Square?"). Transiter was originally written in Python, but over the course of the last year I rewrote it in Go. This article is my contribution to the “porting X from Python to Go” genre, which is admittedly…

Non-reproducible builds in Python

For the last four or five years I’ve worked on-and-off on a sizable enough Python side project. By far the most frustrating aspect of maintaining it has been that if I leave it alone for a few months and then come back to add some small feature, I cannot in general rebuild the project. Something simple like executing pytest to run all the unit tests just does not work. Instead, I have to first…

Another token peeking side effect in TeX

When processing a stream of tokens in a language parser, we generally assume that peeking at the next token does not have any side effects. In a previous post I described how this is not the case in TeX. In that post we had a token whose expansion rules were changed after the token was peeked at but before it was fully consumed. In TeX, the peek operation has the side effect of expanding tokens it…

A time-traveling edge case in TeX

Suppose you have the following raw TeX (not LaTeX) file first.tex: \def\month{\relax The month is May.} \input second.tex \month This defines a custom macro, inputs a second file, and then prints the output of the custom macro. Suppose that second.tex contains: June has begun. \def\month{\relax The month is now June.} What’s the output of pdftex first.tex? It’s what you’d expect:…