Ufuk Kayserilioglu
👤 PersonAppearances Over Time
Podcast Appearances
Class methods, sorry, all the instance methods in mailers that are turned into class methods, all the helpers on your controllers, they're all happening at runtime in Rails. So Sorbet Rails was the first attempt to actually build a gem. that could generate Ruby interface files for all those things so that Sorbet can look at the Ruby interface file.
Class methods, sorry, all the instance methods in mailers that are turned into class methods, all the helpers on your controllers, they're all happening at runtime in Rails. So Sorbet Rails was the first attempt to actually build a gem. that could generate Ruby interface files for all those things so that Sorbet can look at the Ruby interface file.
So you have your shop model or like shop.rb file, which hosts your shop model, but you also have this shop.rbi file that's generated for you, which contains all the method definitions that would be on the shop model dynamically. So having that Sorbet can say, oh yeah, okay, I know shop has this name method. So if you call shop.name, then yes, I know what that is.
So you have your shop model or like shop.rb file, which hosts your shop model, but you also have this shop.rbi file that's generated for you, which contains all the method definitions that would be on the shop model dynamically. So having that Sorbet can say, oh yeah, okay, I know shop has this name method. So if you call shop.name, then yes, I know what that is.
And even better, if you can also create signatures for it. So if you can tell it what parameters it takes and what the return type is, then you can also keep typing those things as well. So you can build on those types as well. So Sorbet Rails was the initial solution to this.
And even better, if you can also create signatures for it. So if you can tell it what parameters it takes and what the return type is, then you can also keep typing those things as well. So you can build on those types as well. So Sorbet Rails was the initial solution to this.
But we also realized that we had other metaprogramming DSL concerns within our code base that obviously wasn't addressed by Sorbet Rails. So we wanted a broader framework. So we built one in-house and we actually are in the process of folding that also into Tapioca so that Tapioca becomes this one Swiss army tool of generating RBIs, either from gems or
But we also realized that we had other metaprogramming DSL concerns within our code base that obviously wasn't addressed by Sorbet Rails. So we wanted a broader framework. So we built one in-house and we actually are in the process of folding that also into Tapioca so that Tapioca becomes this one Swiss army tool of generating RBIs, either from gems or
or from all the DSL metaprogramming that's going on across your codebase. And initially we've again targeted the same Rails metaprogramming concepts. So we borrowed and built on some of the solutions from SurveyRails, but we've also built DSL generators for
or from all the DSL metaprogramming that's going on across your codebase. And initially we've again targeted the same Rails metaprogramming concepts. So we borrowed and built on some of the solutions from SurveyRails, but we've also built DSL generators for
other common gems across our code base and we intend to to grow that set based on contributions from the community so we have a generator for active record type store frozen records identity cache that's also a shopify gem so like rails plus a few gems will already be addressed with Tapioca.
other common gems across our code base and we intend to to grow that set based on contributions from the community so we have a generator for active record type store frozen records identity cache that's also a shopify gem so like rails plus a few gems will already be addressed with Tapioca.
And that was the biggest pain point, stopping us from increasing our typing even further across our cloud base.
And that was the biggest pain point, stopping us from increasing our typing even further across our cloud base.
Yes, great question. So the obvious headline thing for Sorbet is to obviously to ensure that your code is typeset, right? So that you're not making silly mistakes, that you don't have references to classes or modules across your code base that are no longer there.
Yes, great question. So the obvious headline thing for Sorbet is to obviously to ensure that your code is typeset, right? So that you're not making silly mistakes, that you don't have references to classes or modules across your code base that are no longer there.
We've found many instances of that across our code base through the use of Sorbet, for example, or that you're not calling methods on constants that don't actually have those methods, or that you're not providing arguments to those methods that they don't actually accept. So all of those things, if you're working on a normal Ruby code base,
We've found many instances of that across our code base through the use of Sorbet, for example, or that you're not calling methods on constants that don't actually have those methods, or that you're not providing arguments to those methods that they don't actually accept. So all of those things, if you're working on a normal Ruby code base,
all of those concerns, you can only discover them at runtime. So you either need to have extensive testing to ensure that all those edge cases are executed on your CI, or you discover them in production. So the initial goal is obviously was to reduce those types of trivial errors as much as possible. Unfortunately, in our initial adoption phase, we couldn't validate or invalidate that hypothesis.
all of those concerns, you can only discover them at runtime. So you either need to have extensive testing to ensure that all those edge cases are executed on your CI, or you discover them in production. So the initial goal is obviously was to reduce those types of trivial errors as much as possible. Unfortunately, in our initial adoption phase, we couldn't validate or invalidate that hypothesis.