<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Blog on James Fennell</title>
		<link>https://jpfennell.com/posts/</link>
		<description>Recent content in Blog on James Fennell</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Mon, 07 Apr 2025 18:05:40 -0400</lastBuildDate>
		
			<atom:link href="https://jpfennell.com/posts/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>A surprising enum size optimization in the Rust compiler</title>
				<link>https://jpfennell.com/posts/enum-type-size/</link>
				<pubDate>Mon, 07 Apr 2025 18:05:40 -0400</pubDate>
				<guid>https://jpfennell.com/posts/enum-type-size/</guid>
				<description>&lt;p&gt;Enums are one of the most popular features in Rust.&#xA;An enum is type whose value is one of a specified set of variants.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/// Foo is either a 32-bit integer or character.&#xA;enum Foo {&#xA;    Int(u32),&#xA;    Char(char),&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Values of type &lt;code&gt;Foo&lt;/code&gt; are either&#xA;integers (e.g. the variant &lt;code&gt;Foo::Int(3)&lt;/code&gt; with a payload of &lt;code&gt;3&lt;/code&gt;)&#xA;or characters (e.g. the variant &lt;code&gt;Foo::Char(&#39;A&#39;)&lt;/code&gt; with a payload of &lt;code&gt;&#39;A&#39;&lt;/code&gt;).&#xA;If you think of structs as being the &lt;em&gt;and&lt;/em&gt; combination of their fields,&#xA;enums are the &lt;em&gt;or&lt;/em&gt; combination of their variants.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Migrating Transiter from Python to Go</title>
				<link>https://jpfennell.com/posts/transiter-python-go/</link>
				<pubDate>Sat, 22 Oct 2022 22:05:40 -0400</pubDate>
				<guid>https://jpfennell.com/posts/transiter-python-go/</guid>
				<description>&lt;p&gt;&lt;a href=&#34;https://github.com/jamespfennell/transiter&#34;&gt;Transiter&lt;/a&gt;&#xA;is a backend web service that subscribes to transit data feeds&#xA;and provides an HTTP API for querying the data&#xA;(e.g., &amp;ldquo;when are the next trains at Times Square?&amp;rdquo;).&#xA;Transiter was originally written in Python,&#xA;but over the course of the last year I rewrote it in Go.&#xA;This article is my contribution to the &amp;ldquo;porting X from Python to Go&amp;rdquo; genre,&#xA;which is admittedly well-trodden, but I hope it’s interesting nonetheless.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Non-reproducible builds in Python</title>
				<link>https://jpfennell.com/posts/python-dependencies/</link>
				<pubDate>Wed, 22 Jun 2022 22:05:40 -0400</pubDate>
				<guid>https://jpfennell.com/posts/python-dependencies/</guid>
				<description>&lt;p&gt;For the last four or five years I’ve worked on-and-off on a&#xA;&lt;a href=&#34;https://github.com/jamespfennell/transiter&#34;&gt;sizable enough Python side project&lt;/a&gt;.&#xA;By far the most frustrating aspect of maintaining it has been&#xA;that if I leave it alone for a few months and then come back to add some small feature,&#xA;I cannot in general rebuild the project.&#xA;Something simple like executing &lt;code&gt;pytest&lt;/code&gt; to run all the unit tests just does not work.&lt;/p&gt;&#xA;&lt;p&gt;Instead, I have to first spend a non-trivial amount of time debugging error messages&#xA;like the one that appeared when I tried to build the project earlier this week:&lt;/p&gt;</description>
			</item>
			<item>
				<title>Another token peeking side effect in TeX</title>
				<link>https://jpfennell.com/posts/tex-peek-cat-codes/</link>
				<pubDate>Fri, 24 Sep 2021 20:05:40 -0400</pubDate>
				<guid>https://jpfennell.com/posts/tex-peek-cat-codes/</guid>
				<description>&lt;p&gt;When processing a stream of tokens in a language parser,&#xA;we generally assume that peeking at the next token does not have any side effects.&#xA;In &lt;a href=&#34;../tex-expansion-edge-case&#34;&gt;a previous post&lt;/a&gt; I described how this is not the case in TeX.&lt;/p&gt;&#xA;&lt;p&gt;In that post we had a token whose expansion rules were changed&#xA;after the token was peeked at but before it was fully consumed.&#xA;In TeX, the peek operation has the side effect of expanding tokens it encounters,&#xA;and TeX never undoes this expansion.&#xA;In our case the token was expanded using the rules in effect at the time of the peek&#xA;rather than the time of consumption, giving a somewhat counterintuitive result.&lt;/p&gt;</description>
			</item>
			<item>
				<title>A time-traveling edge case in TeX</title>
				<link>https://jpfennell.com/posts/tex-expansion-edge-case/</link>
				<pubDate>Thu, 08 Jul 2021 20:05:40 -0400</pubDate>
				<guid>https://jpfennell.com/posts/tex-expansion-edge-case/</guid>
				<description>&lt;p&gt;Suppose you have the following raw TeX (not LaTeX) file &lt;code&gt;first.tex&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;\def\month{\relax The month is May.}&#xA;\input second.tex \month&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This defines a custom macro, inputs a second file, and then prints the output of the custom macro.&#xA;Suppose that &lt;code&gt;second.tex&lt;/code&gt; contains:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;June has begun.&#xA;\def\month{\relax The month is now June.}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;What&amp;rsquo;s the output of &lt;code&gt;pdftex first.tex&lt;/code&gt;? It&amp;rsquo;s what you&amp;rsquo;d expect:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;June has begun. The month is now June.&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The custom macro &lt;code&gt;\month&lt;/code&gt; is first defined, then the second file is processed during which the macro is redefined,&#xA;so when &lt;code&gt;\month&lt;/code&gt; is expanded it has the second definition.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
