This week’s theme song is 16 Horsepower’s “Black Soul Choir”, all banjo and brimstone, because we shipped a release with some brimstone in it. ponyc 0.64.0 is out. Three breaking changes, two long-standing compiler bugs put to bed, and the recursive type alias work all landed in one drop. The whole networking stack moved over with it. Red also shipped the first release of a timezone library.
Here’s how it is: for a few years, off and on, I went looking for a bug.
My aarch64 testing machine, a sturdy little Raspberry Pi, was the site of so very many segfaults. The same tests would fail run after run, and I could boil the crash down to a handful of lines of try and error. It came out of the machinery Pony uses to unwind the stack when error fires. So I’d pull that code up and compare it to the spec. It looked right. I’d run out of leads and put it down. Months later I’d pick it up and start over.
I never found it.
I kept coming back to it. I’d talk it through with Sylvan, and we’d end up in the same place. I’d talk it through with Joe, and we’d end up there too. The bug probably isn’t ours. It’s probably down in the guts of LLVM, somewhere we don’t own. Probably.
So I stopped chasing the bug and looked at where it lived: the stack unwinding. Pony doesn’t have to unwind the stack to raise an error. Take the unwinding away, and the bug has nowhere left to be. Soon, that’s how it’ll work — there’s a pull request open against the compiler that takes stack unwinding out of Pony’s errors, and that bug is part of why I wrote it. But only a part.
What comes around goes around. I’ll tell you why, why, why, why.
That is, near enough, how the Pony compiler’s subtype check works on a type that refers to itself. It follows the type down into its own structure, and for an ordinary self-referential type it soon comes back around to a pair it is already checking further up. That return is the exit. What comes around closes, and the check finishes.
This is a story about two types where the check went down and never came back around. One of them sent the compiler into a loop with no end. The other ran it off the end of its stack and knocked it over. One was reported in 2016, the other in 2021, and both closed in a single pull request.
One theme song wasn’t going to cover this week, so you’re getting three, and all of them are gospel. PR 5246 merged. Finite recursive type aliases are in ponyc, and the oldest open issue in the repository, eleven years on the books, is closed. I have been buried in this for weeks. It’s done. So we open with Johnny Cash, “It Was Jesus” and “Swing Low, Sweet Chariot”, and then the Blind Boys of Alabama, “Jesus Gonna Be Here Soon”. Hallelujah. It was a glorious week and I’m in the mood to celebrate.
There’s more than the merge. Three blog posts went up telling the whole story behind the alias work, and we put our stance on AI-assisted contributions in writing. An exploratory port of Pony to Haiku opened, which made two old BeOS hands very happy. And the old HTTP libraries are on their way out.
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.
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.
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.
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.
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?
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.