text stringlengths 0 2.46k |
|---|
**Jake Zimmerman:** Yeah. It's probably just a relative popularity thing. I think that people's primary programming language tends to be just such a large fraction of how they think and how they approach problems, and if you're used to something, you want to switch -- if that thing is so different from the thing that y... |
**Jerod Santo:** So what is some of the origin story? How did you get to working on this? You mentioned people already wanted it, so apparently there was a desire inside of Stripe for something like this, but how come you -- and you've been working on it for a long time before the show. You said you eat, drink and drea... |
**Jake Zimmerman:** Yeah, yeah. So I mentioned it started in kind of the fall of 2017. It started with two people who had been working at Stripe for a number of years, and one person that we had hired from just finishing his PhD, working on the Scala compiler. So it was a very small team, a very experienced set of peop... |
\[12:08\] When I was in school, I was always just super-interested in types and programming languages. I didn't really realize this until basically my last year of being in university. If I had realized it maybe a year or so sooner, it's possible I wouldn't have even joined Stripe, and I would have tried to do some sor... |
And so I was one year out of school, I was working with three really experienced people, who had basically this mandate, like "Your whole job now is to train this other person." So it was a great environment, and again - yeah, because I already knew that I was kind of interested in it, I just kind of dove right in. And... |
**Jerod Santo:** Was that ahead of time compiler? Was that work - it ended up not being super-fruitful, so you went back to it? Or what was the story when you went down that path? |
**Jake Zimmerman:** Yeah, the compiler project - it was kind of interesting. It was at a point in time when latency was the primary concern for pretty much every team at Stripe. This was during the height of the pandemic, when suddenly everyone across the internet who was running a software company was seeing increased... |
**Jerod Santo:** That's cool. So inside of Stripe then, if you could come up with a percentage of how much code is "sorbeted" across the codebase - do you have those numbers? Do you know how much is -- |
**Jake Zimmerman:** Yeah, yeah. Less than 1% is not using Sorbet. |
**Jerod Santo:** Oh, wow. |
**Jake Zimmerman:** \[15:49\] Yeah. There's kind of various strictness levels to what it means to have Sorbet turned on. So at the very bottom level it's what we call typed false. And even still, even though it says "typed false", it's still doing some kind of sanity checking, which - it'll make sure that all of the cl... |
I think we even have that typed strict level - so it's like 99% typed true or higher, but at typed strict I think we're somewhere close to like 80%, or something like that. It's the sort of thing where over time people encounter the file that doesn't have type annotations, and encounter the files that do have type anno... |
**Adam Stacoviak:** That's interesting. Network effects, in a sense, right? |
**Jake Zimmerman:** Exactly. |
**Adam Stacoviak:** Like "Hey, this file doesn't have this. I want to bring it in there." It's good stuff. It's crazy to have such a project take over, too. In one of the posts - I think it's a 2018 post, saying "Where Sorbet is at now." This is state of Sorbet, spring 2018. It actually says "100% of our production Rub... |
**Jake Zimmerman:** Yeah, so there's all sorts of different things. I think that the quote that I like bringing up here is the first time that we -- so we've built this type checker, and it was really just kind of like this policeman just kind of like enforcing that you're not doing the wrong thing. In the beginning, t... |
So the first time that we sent an email to the company saying "You can now use Sorbet to get accurate jump to definition", people were telling us "This is the best Christmas present you could have ever given me. It's July, I don't even care." I think that people really identify with being able to understand their code,... |
**Adam Stacoviak:** It sounds a lot like what Sourcegraph markets, too. They call it code spelunking. I've heard Beyang Liu talk about that... Like, being able to jump to definition and explore a codebase - especially if you're moving teams, like Jerod mentioned before... If you're moving from one shop to another, you'... |
**Jake Zimmerman:** Yeah. And it might be a problem that you only realize is a problem at a certain codebase size. For example, even inside the Sorbet codebase itself, it's only ever been worked on by two or three people full-time. The codebase itself is only maybe 100,000 lines of code. But when you get into these cod... |
**Jerod Santo:** \[19:57\] When I think about programming languages that lend themselves towards type checking enforcement, Ruby is like on the bottom of that list, isn't it? I mean, this had to be a monumental task, because it's so malleable, it's so self-referential, it has reflection, it has metaprogramming... You c... |
**Jake Zimmerman:** Yeah, I will definitely agree with you that the kind of dynamism of Ruby is both a huge strength, and that it's been what's let communities like the Rails community succeed, but also a big challenge, just because those sorts of -- like, when you can only understand what the code is doing at runtime,... |
It's interesting, because Stripe actually started -- Stripe has never used Rails, but it has used a lot of metaprogramming, in especially its early history... And as people have started to adopt Sorbet at Stripe, it's kind of been this incremental rejection of the metaprogramming parts of Ruby. Part of this is because ... |
To dive into some specifics, if you can just basically read a network request that the static analysis tool is never gonna be able to see, and using the contents of that network request you're gonna be able to define methods in Ruby. You could ask the user to defer the name of a method to define, and define it. And the... |
So stuff like that has its place, and Sorbet basically just gives you escape hatches to be able to use that stuff. So again, we were talking about the typed false levels; if you have a certain file that's using a lot of meta programming, you can just opt to turn checking off in that file, where it's maybe super-metapro... |
**Jerod Santo:** Are there any facilities in there to outlaw? You know, like "Hey, no method missing", for example. "We're not going to have method missing." Or maybe that's not really a Sorbet thing. Maybe that's like a linter -- I don't know. I guess Sorbet is kind of a linter on steroids, isn't it? I mean, how do yo... |
**Jake Zimmerman:** Yeah, I think linters and type checkers are very complimentary. The thing about linters is they're way more heuristic-based, and so you kind of want the ability to say "I know better than the heuristic in this particular case." In Sorbet the rules kind of apply universally. So we are kind of more co... |
**Jerod Santo:** \[24:15\] There's probably some method missing in there somewhere. We should explain method missing, for those who aren't regular Ruby programmers. So briefly, in Ruby, if you call a method on a module or on a class, and that class or that object of that class doesn't have the method that you just call... |
**Jake Zimmerman:** Yup. So method missing is definitely one of those kind of tricky parts for Sorbet to analyze, but it's far from the only one. We do have plenty of linter rules that we turn on to basically say "This is okay, this is not okay", and yeah, kind of guide people into having the most success when using So... |
**Break**: \[25:32\] |
**Jerod Santo:** So one thing that Max brought up is like first-party, I guess, Ruby official types, which he says in the works -- I don't know much about this. I'm sure you probably know a lot about this, Jake, just from being in the community... Tell us about that, how it relates to Sorbet, are they wildly different?... |
**Jake Zimmerman:** Yeah, I think it's mostly divisive just because typing in generalist is divisive in the Ruby community, mostly. |
**Jerod Santo:** Right. Not like a specific implementation. That's going on in the Elixir community right now as well, is they're talking about types for Elixir... And that's divisive, because - same exact reasoning. |
**Jake Zimmerman:** Yeah. And so obviously, as someone who works on a type checker and who has been interested in types for a very long time, I'm super-biased in favor of the typing side of this. And I hold the view that types will always win in the long term, but... So you're gonna get the bias view here on the state ... |
So Sorbet kind of started as this just one more type checker sort of thing. So it's always been the case that people have noticed that Ruby didn't have types built into it, and kind of decided on various ways to add their own. Eventually, I think that the popularity of Sorbet and the kind of backing of having such a la... |
We actually have met multiple times with the Ruby core team. For a period of time, we were meeting with them monthly to kind of talk about what the state of typing in Ruby would look like... And over time, it became apparent that the design constraints that we were going to be working under would be no syntax changes t... |
Some people will say that is already a non-starter for them. That no matter what syntax you choose for these definition header files, that it's already going to not work for them and cause a division in the community. That's, I think, a valid concern, but let's just press forward and say that we're fine with having the... |
So Sorbet already had this type annotation syntax that was valid Ruby code, and to make these kind of header files, these definition files, it repurposed that existing syntax. So you only had to learn one way to declare the type of an array, you only had to learn one way to declare a signature for a method, to declare ... |
\[32:16\] So at the same time that we were working on defining these separate files, we came to the realization that we don't have to be backwards compatible with Ruby in these new files. We could just throw everything out the window and design a type annotation syntax that would be a little bit more elegant, but not n... |
At the end of the day though, they are just annotations, and Sorbet could one day just parse them, and understand the annotations that are in them. I think that that's mostly just been -- we haven't quite gotten the feedback that people would really absolutely love to use Sorbet, but also like the one thing holding the... |
**Adam Stacoviak:** Okay, good explainer of the state of things, at least from specifically on the Sorbet side. What about on like the Ruby lang's side, with this RBS? Is it going to happen? |
**Jake Zimmerman:** Oh, it's already happened. |
**Jerod Santo:** It's already out there, and -- |
**Jake Zimmerman:** Yeah, they shipped these annotations, this format in Ruby 3.0. |
**Jerod Santo:** Okay, so it's shipped, and public, and you can just use Ruby 3.0 Plus, and annotate your Ruby with the RBS files. And it's just a built-in type checker into the language, or...? |
**Jake Zimmerman:** So it's still you have to pick and choose your third party type checker. The annotation format is just -- |
**Jerod Santo:** Okay, so it's not like built-in then. It's like a spec. |
**Jake Zimmerman:** Exactly. |
**Jerod Santo:** Okay. |
**Jake Zimmerman:** Probably the most popular type checker that uses these annotations is the Steep type checker, which I mentioned earlier. |
**Jerod Santo:** Okay. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.