Projects and examples
Small pieces of code to accompany the posts. Each download is plain text; the linked note explains the assumptions and expected behavior.
The five Python test examples require Python 3.10 or newer and only the standard library. Run a downloaded file with python3 filename.py; a successful run ends with OK. C examples use C11; the checked-add example is a function to place in a test harness. Haskell and schema snippets are illustrative.
Go users: the historical zenhack.net/go/util import path points to its original upstream repository. The package page explains version compatibility.
Promise pipelining removes a wait, not a dependency
Illustrative protocol or diagnostic sketch. promise-pipelining.txt
A useful setup log starts with the question it can answer
Illustrative protocol or diagnostic sketch. debugging-records.txt
A command line is an argument vector before it is a shell string
Locally checked Python example. subprocess-argument-boundary.py
Endianness belongs in the format, not in a lucky host assumption
Locally checked Python example. endianness-is-a-format-choice.py
A virtual environment has an interpreter boundary
Locally checked Python example. venv-interpreter-boundary.py
Make an invalid state unrepresentable at the interface
Illustrative Haskell definition. types-as-interface-decisions.hs
Validate CSV headers before building dictionaries
Python 3.10+ · standard library · executable unittest checks. how-can-you-validate-a-csv-header-quickly.py
Testing a schedule cache across feed revisions
Python 3.10+ · standard library · executable unittest checks. how-can-you-test-a-cache-after-a-feed-version-changes.py
A durable idempotency key in one SQLite transaction
Python 3.10+ · standard library · executable unittest checks. what-does-idempotency-mean-in-a-network-protocol.py
Parsing GTFS times beyond midnight
Python 3.10+ · standard library · executable unittest checks. why-can-gtfs-times-exceed-24-00-00.py
CSV round trips: commas, quotes and embedded newlines
Python 3.10+ · standard library · executable unittest checks. how-should-a-csv-file-handle-commas-in-text.py
A byte stream does not know where your messages end
Locally checked Python example. transport-is-not-framing.py
Why len(x) is not just x.__len__() in disguise
Locally checked Python example. python-special-method-lookup.py
A Python name is a binding, not a box containing a copy
Locally checked Python example. python-bindings-and-mutation.py
Changing a Cap’n Proto schema without renumbering history
Illustrative schema. capnp-schema-evolution.capnp
A closure in C is a function plus an environment
Locally checked C example. closures-without-nested-functions.c
C is an abstract machine, even on familiar hardware
Locally checked C example. c-abstract-machine.c
Upstream projects
These are independent projects discussed in the notes, maintained by their respective developers.
- Sandstorm
- A platform for self-hosted web applications, with sharing and isolation built around grains.
- Cap’n Proto
- A schema language, serialization format and capability-oriented RPC protocol.
- Haskell Cap’n Proto
- The upstream project’s GitHub mirror. Its README points to its official home on Codeberg.
- Tempest
- An upstream systems project; the repository reading note explains what its source can tell us.