Some Old Sorbet Compiler Notes

From January 2020 to December 2021 I was primarily working on the Sorbet Compiler, an experimental, ahead-of-time compiler for Ruby, targeting native code. For most of that time, it was a mostly-secret, internal-only project. Today I’m publishing a few of my old, internal-facing notes about the compiler here to my blog.

In July 2021 we open sourced the Sorbet Compiler,… not so much because it was ready for widespread adoption but largely because it made some internal logistics easier!

but there’s not much written about it outside of Stripe. It’s basically just the above blog post and this talk that Trevor Elliott and I presented at RubyConf 2021:

While I was working on the compiler internally, I wrote up some informal notes about how the compiler worked and the potential it could have. None of those notes were particularly privy to confidential information—it was just that the compiler was not a public project at the time, so it didn’t make sense to post them publicly.

I’ve gone back and taken those internal notes and published them here to my blog. (Mostly, I just wanted to fill in the gaps on my blog.Before reposting these Sorbet Compiler posts, I only posted publicly five times in 2020 and twice in 2021 😞

) Note that they are all quite old now, and may not be as accurate as they were at the time of writing. I’ve dated them with the date they were published internally to reflect that, which means you’ll have to find them in the archives.

Note that the compiler is still not a project that we would encourage anyone to use. At this point, it hasn’t seen active development for the better part of the last year as we’ve focused on improvements to Sorbet itself (though we have kept the test suite running, so things are unlikely to have slipped into complete disrepair).

The official word is still what’s written in the sorbet.org blog post:

We want to be clear up front: the code is nowhere near ready for external use right now, but we welcome you to read the code and give us feedback on our approach!

Anyways, maybe you’ll enjoy the assorted notes digging into some of the compiler’s guts. If you have questions, feel free to reach out.