Tombstone
Goat: Lamancha and Maketree
Late 2018 โ mid 2019 ยท age 36โ37
What it was
Lamancha is an XML language for screens, and Maketree is the generator that wrote almost all of it. A document holds roots of layout, paint, shape, shader and touch nodes, rendered with SkiaSharp, and a single variable can switch which root is on screen. Every attribute is a plain value or, with .E on the end, a live expression in a small Lisp over a JSON variable tree that the game server fills. The node tree was not written by hand: a fluent C# schema described about a hundred node kinds, and the generator emitted parsers, deep copy, visitors, JSON export, tests and documentation, with hand code kept safe in partial classes. Animations told the host when they next needed a frame, and tests drove a captured clock so a moving screen could be compared, pixel for pixel, against gold images.
Wins, for the age
- At thirty-six, Jeff got about twenty-three thousand generated lines out of three thousand of schema, a ratio that made a language with hundreds of properties tractable for one person. One primate, wisely refusing to type twenty-three thousand lines by hand.
- Let any attribute become a live expression, finding on its own what QML property bindings (2010) had already found.
- Made time a variable, so animation became testable, the same trick as Sinon.JS fake timers (2010), rediscovered from inside a renderer.
- One example file became a unit test, a rendered image checked against gold and a documentation page. Adding a feature meant writing one example.
What it taught
- Generated code needs a room for hand code. Partial classes were the single decision that kept the generator in use.
- Gold images rot. Ninety-six of 395 snapshots differed at the end, because the tool had no command to bless new ones.
- A one-line stub per node is not documentation, and a generator will faithfully publish every TODO.
- Relative paths four levels up are a build system that works on exactly one machine.
Genealogy
Ancestors: Farm Cron: the schema written as code, generating the rest. Kitchen ZMLC2: a schema compiler emitting data classes and serializers. Descendants: Lamancha I: the same engine and bindings, carried into the next attempt. Part of: Goat.
Epitaph
Here lies Lamancha: a hundred node kinds, one schema, and a
.Eon every attribute that wanted to move.