It does occasionally require structuring your code differently, but I find the type-system-encouraged approach often gives a more elegant and harder-to-misuse interface in the end.
I spend my working life swapping between Ruby and typescript projects and the typescript project is utter garbage with poor test coverage that needs a day of human QA for every build whereas the Ruby project is well tested such that we know that CI passing means it’s good to be released.
(I also work in a 40m+ loc non-rails ruby codebase that is almost entirely typed with Sorbet.)
Adds type annotations to the core language syntax. The compiler does type checking, strips the annotations, and outputs plain Ruby.
Why is it important to be a separate layer that compiles to plain untyped Ruby?
Same reason Typescript was made and we didn’t add types to JavaScript.
How so?
I never really missed types in Ruby, even if I like them a lot in typescript, but right now I'm doing some "vibe coding" on a personal project and I was thinking about trying Sorbet. I think that it could help Claude Code avoid some mistakes it often makes which make it waste a lot of time fixing.
When vibe coding, what I noticed is that CC tends to make mistakes which it does catch with tests and fix on its own, but my hope is that using Sorbet this will happen much less, and thus development will go faster with less (slow) test cycles.