Skip to content

Blog

Making Finite Recursive Type Aliases Compilation Fast

This is the third post in a short series on finite recursive type aliases in Pony. The first post told the story of the eleven years it took to allow them. The second post laid out the algorithm that decides which recursive aliases are legal.

That algorithm is correct. Correct isn’t enough. Past a certain size, a tangle of type aliases that all refer to each other sent the compiler’s type checker into exponential work. Slow at first. Then, on a bigger tangle, eleven minutes of churning with no end in sight. The compiler wasn’t rejecting these programs — the algorithm accepts them. It just couldn’t finish checking them in any reasonable time.

Inside Pony’s Finite Recursive Type Aliases

This is the second post in a short series on finite recursive type aliases in Pony. The first post told the story of why this took eleven years. As I write this, the pull request that adds the feature is open and in review on ponyc. It hasn’t merged yet. Details may shift before it does, but everything in this post is foundational. It should all hold.

So how does the compiler tell a finite recursive type alias from an infinite one?

The algorithm is Tarjan’s strongly connected components. I’ll walk through it. Then I’ll show you the two checks I built on top of it.

Eleven years to a finite recursive type alias

There’s a pull request open against the Pony compiler. It’s in review right now. When it lands, and it will land soon, you’ll be able to write this:

use "collections"

type JsonValue is
  ( String
  | F64
  | Bool
  | None
  | Array[JsonValue]
  | Map[String, JsonValue])

Today the compiler rejects it. JsonValue mentions Array[JsonValue], which mentions JsonValue, and ponyc throws up its hands: type aliases can't be recursive. That has been true for the entire history of the language. It’s about to stop being true, and the pull request that changes it closes out the oldest open issue in the ponyc repository.

Last Week in Pony - May 17, 2026

This week’s theme song is “You Wreck Me” by Tom Petty. Tom Petty! It’s been on rotation while I’ve been buried in PR 5246, the finite recursive type aliases work. That’s the big job I warned you about last week. The one eating my coding hours and keeping the Pony news drumbeat quiet. Tonight we ride. Because… Tom Petty!

Quiet doesn’t mean nothing. A new blog post went up on why I pulled documentation generation out of the compiler. Office Hours had Adrian taking a CLI-based LLM tool for its first spin. And I filed an official RFC request for someone to design optimization options into ponyc.

pony-doc: From the back pew to the front pew

ponyc --docs is how you used to generate Pony API documentation. For more than a decade, you’d run that command, point it at a package, and the compiler would write you documentation in MkDocs-compatible format. It was quiet. It was reliable. It was boring.

Last month I deleted the documentation pass from the compiler. pony-doc, a separate Pony program, generates Pony documentation now. It creates the same output as the old documentation pass did. We switched all our sites over from one to the other and no one noticed.

So why move documentation generation out of the compiler? Why do work that has no discernible change for the user? Why now, after a decade of ponyc --docs working just fine?

Last Week in Pony - May 10, 2026

This week’s theme song is “My Bucket’s Got a Hole in It” by Tim Timebomb. Looks like Pony’s bucket has sprung a leak this week, doesn’t it? It hasn’t.

You’ve been getting a steady drumbeat of Pony news for months now. That drumbeat goes quiet this week, and it’ll stay quiet for a stretch. Don’t read it as the momentum dropping off. The water’s all running into one place — a big job that’s eaten most of my coding hours, more on it below.

pony-lint: Codifying the Style Guide

A couple months ago I wrote about teaching Claude to write Pony. The shorthand version: treat the LLM like a junior developer with no memory, build up a CLAUDE.md, refine it as you find where Claude falls short. The CLAUDE.md got Claude most of the way there.

The piece it never quite covered was the style guide. There’s one for the projects under the ponylang GitHub org. It has rules for indentation, line length, naming, where blank lines go. Claude would write code that compiled and worked but didn’t follow the rules. Indentation that should have been two spaces would land on three. A type name would pick up an underscore. A function that belonged on three lines would end up jammed onto one. Stray trailing whitespace. Each one I’d correct. And correct it again. And again.

Last Week in Pony - May 3, 2026

This week’s theme song is “Voodoo Child” by Monica Valli. Trust me on this one.

Big release week. ponyc 0.63.4 ships two new pony-lsp features. Signature help pops up the parameters of the method you’re calling and highlights the one you’re filling in. Type hierarchy navigation lets your editor walk between a type, its supertypes, and its subtypes. The release also fixes a link failure on Fedora-family distributions, a multilib crt1.o gotcha, and a match exhaustiveness hole on Bool tuples. The RFC front was busy too: three new proposals and one across the finish line. Let’s get into it.

Last Week in Pony - April 26, 2026

This week’s theme song is from the man himself, Johnny Cash: “Take Me Home”. I’ve been on the road for two weeks and I’m finally back home, so this one fits.

Plenty to dig into. ponyc 0.63.3 ships another round of pony-lsp work and tightens the runtime’s memory ordering on its hottest queues. ponylang/ssl picked up OpenSSL 4.0.x support and the matching builder image is live. There’s also Ubuntu 26.04 support, a new blog post on the design of pony-lsp, and a couple of RFC moves to chew on. Let’s get into it.

pony-lsp: An Actor and a Callback

Embed You a ponyc for Great Good introduced libponyc-standalone, a static compiler library you can link your tools against, and a Pony wrapper called pony-ast that exposes the compiler as a callable function. This post is about the Pony language server we built on top of it.

A quick disclaimer before I get going. Almost none of pony-lsp is my work. Matthias Wahl built it from scratch. He wrote the actor architecture, the message dispatch, and the original feature set. He also wrote pony-ast. Orien Madgwick has been pushing it forward; most of the new features over the past several months are his. My contribution is mostly fixing things that broke when I imported the project into ponyc, plus a small feature here and there. The clever stuff is theirs.