As part of our adoption process of Sorbet at Shopify, we needed an automated way to teach Sorbet about our ~400 gem dependencies. We tackled this problem by generating a Ruby Interface file (RBI) for each gem using runtime reflection. Thus, the gem
tapioca was born. With the recent addition of RBI generation for various DSLs, including Rails, Tapioca has become the perfect complement to Sorbet and is the exclusive tool used at Shopify for gradual type adoption.
Come join us and see how Tapioca can make Sorbet taste even better, and how you can also start using it in your Sorbet recipes.
The intended audience of the talk will be people who are thinking about adopting Sorbet in their codebases or have had problems with adoption before.
The desired outcome of the talk will be to have empowered the listeners with a new tool to help them on their journey in gradual type adoption. Moreover, we aim to present some of the runtime reflection techniques that we have used to build the tool, which could be useful for a more general audience.
A rough outline of the talk will be as follows:
During our 1.5 year experience of adopting Sorbet at Shopify, we've realized that the biggest obstacles to adoption are gem definitions and dynamic methods.
Since Sorbet does not analyze the codebase's gem dependencies it needs to be told about the types coming from gems. Moreover, since Sorbet is a static type-checker, it needs to be told about all the methods that are dynamically created at runtime by various DSLs (for example, all the attribute definitions in Active Record models, that don't even have any static artefacts in the codebase).
This talk will present an overview of how we've solved these problems at Shopify and how we have shared it as an open-source project for the whole community to use and build upon. It will outline the obstacles new comers could face adopting Sorbet, and outline how they can be overcome using Tapioca.
The speaker is the primary author of the open-source
tapioca gem and has been leading the effort of gradual type adoption at Shopify.
RubyConf 2020 - Rejected [Edit]Add submission