Stripe is open sourcing its Ruby type checker in the hopes to help and collaborate with the Ruby community. Sorbet is designed to type check moral method definitions as well as introduce backwards-compatible syntax.
In addition, the type checker is multithreaded to scale across cores, IDE-ready, interactive, and enables Ruby developers to keep their existing toolchain.
“Explicit method signatures make Sorbet useful for anyone reading the code too (not just the author). Type annotations serve as a tool for understanding long after they’re written.
Sorbet is designed to be useful, not burdensome. Explicit annotations are repaid with clear error messages, increased safety, and increased productivity,” the project’s website states.
The open-source release includes the core static type checking, toolings for new Sorbet projects, tools to adopt Sorbet to existing projects, a runtime DSL and a central repository for sharing type definitions.
“We designed Sorbet to be used at Stripe, where the vast majority of our code is written in Ruby. We’ve spent the last year and a half developing and adopting Sorbet internally, and we’re finally confident that Sorbet is not just an experimental, internal project—we’re ready to share Sorbet with the entire Ruby community,” the Stripe team wrote in a blog post.
Beyond Stripe, Sorbet is also being used at Shopify, Coinbase, Atrium, Gusto and Kickstarter.
To help developers get started, Stripe is also providing quick steps to adopting Sorbet, resources on gradual type checking and documentation about Sorbet’s features.