Ufuk Kayserilioglu
👤 PersonAppearances Over Time
Podcast Appearances
Like we need to maintain them to be on the latest versions and everything. But it also means there are lots of classes, modules, constant definitions coming from those gems, but Sorbet doesn't go and look for class definitions inside of gem source code. It just looks at your code base. So it says, oh, you're using this foo class here or like this foo constant here, but I have no idea what foo is.
Like we need to maintain them to be on the latest versions and everything. But it also means there are lots of classes, modules, constant definitions coming from those gems, but Sorbet doesn't go and look for class definitions inside of gem source code. It just looks at your code base. So it says, oh, you're using this foo class here or like this foo constant here, but I have no idea what foo is.
So it needs to be told what foo is, what kind of methods it has, what kind of subconstants it has, what type of a constant it is. Is it a class? Is it a module? What's its superclass? What are the mixins, et cetera, et cetera. So we needed a tool that would just take a gem, somehow introspect it, and then generate an RBI file. So it's called an RBI file. That's a Ruby interface file.
So it needs to be told what foo is, what kind of methods it has, what kind of subconstants it has, what type of a constant it is. Is it a class? Is it a module? What's its superclass? What are the mixins, et cetera, et cetera. So we needed a tool that would just take a gem, somehow introspect it, and then generate an RBI file. So it's called an RBI file. That's a Ruby interface file.
It's almost the same thing as a C header file. So it's just the definitions of all these things that I just said. Is it a class? Is it a module? What's the superclass, mixins, the methods and its arguments? So it just generates those without any of the implementation. So we had to build a tool and we open sourced it afterwards as Tapioca that does that.
It's almost the same thing as a C header file. So it's just the definitions of all these things that I just said. Is it a class? Is it a module? What's the superclass, mixins, the methods and its arguments? So it just generates those without any of the implementation. So we had to build a tool and we open sourced it afterwards as Tapioca that does that.
It takes your gem file, it discovers all the gems, it loads them into memory. Then it does runtime reflection on all the types it can find from all those gems. And then it tries to understand what the shape of all those types are and it generates into a set of RBI files, which then Sorbet can read, and then it knows about foo coming from the gem foo or something.
It takes your gem file, it discovers all the gems, it loads them into memory. Then it does runtime reflection on all the types it can find from all those gems. And then it tries to understand what the shape of all those types are and it generates into a set of RBI files, which then Sorbet can read, and then it knows about foo coming from the gem foo or something.
No, they did. So basically, they had a script that would kind of do the same thing that they were using internally, but it wasn't part of the Sorbet tooling at the time. So they shared the initial skeleton of that script with us. And then we ended up turning that into the tool that's now Tapioca.
No, they did. So basically, they had a script that would kind of do the same thing that they were using internally, but it wasn't part of the Sorbet tooling at the time. So they shared the initial skeleton of that script with us. And then we ended up turning that into the tool that's now Tapioca.
And then the Sorbet team at Stripe, they actually also took that script and then built it into the Sorbet init script. which does something very similar. It also can look into gems and load types and generate Ruby interface files for you. So that ended up being a part of the tool, the Sorbet tool. But we took a slightly different route than that tool.
And then the Sorbet team at Stripe, they actually also took that script and then built it into the Sorbet init script. which does something very similar. It also can look into gems and load types and generate Ruby interface files for you. So that ended up being a part of the tool, the Sorbet tool. But we took a slightly different route than that tool.
And so that's why we're actually using Tapioca internally rather than the Sorbet in its tooling.
And so that's why we're actually using Tapioca internally rather than the Sorbet in its tooling.
Yeah, so the other thing, so going back to the DSL problem, it turned out that making Sorbet run Ruby scripts as it's trying to make sense of your code base statically was a huge slowdown.
Yeah, so the other thing, so going back to the DSL problem, it turned out that making Sorbet run Ruby scripts as it's trying to make sense of your code base statically was a huge slowdown.
So we basically stopped doing it and then also realized that the same approach, even though it has some disadvantages, but the same approach of generating Ruby interface files for all the meta programming would be a much better fit for our problem. So recently we've been working on that problem. There are other
So we basically stopped doing it and then also realized that the same approach, even though it has some disadvantages, but the same approach of generating Ruby interface files for all the meta programming would be a much better fit for our problem. So recently we've been working on that problem. There are other
solutions in the same area as well one of them is for example the gem called sorbet rails that's built by people at the chan zuckerberg initiative so they had the same problems of sorbet not understanding some of the meta programming that's coming from rails again like all the column related methods on models all the association related methods on models all the the
solutions in the same area as well one of them is for example the gem called sorbet rails that's built by people at the chan zuckerberg initiative so they had the same problems of sorbet not understanding some of the meta programming that's coming from rails again like all the column related methods on models all the association related methods on models all the the