3 ms·
I'm curious what the state of Sorbet + Rails is these days. I've been out of the ruby game for a little while now. Last I recall: sorbet itself is quite good o
by hamandcheese 2y ago
I'm curious what the state of Sorbet + Rails is these days. I've been out of the ruby game for a little while now.
Last I recall: sorbet itself is quite good once it is well established in a project, but adding type checking to a project (especially a Rails project) is a lot of work.
- jack_riminton 2y agoConsidering how anti-types dhh is, there is not going to be any official support for this anytime soon. In his most recent interviews the philosophy can be summarised as "if you love types, good for you, but rails isn't for you"
- block_dagger 2y agoThis is pretty close to Matz’s stance as well.
- mahatofu 2y agoPersonally, the argument for strong types is when you’re writing critical foreseeably permanent architecture. It’s an extra layer of security and explanation.
- hu3 2y agoFor me, a sensible use of types helps reducing cognitive load during development. It also help with autocomplete and linting.
- yoran 2y agoWe use it extensively in our codebase. We started without any types, and added Sorbet later. It's similar to Typescript as that you can gradually sparkle your code with types, building up the typing coverage over time. I just completed a big refactoring. We have a good suite of tests. But Sorbet has provided an added layer of confidence. Especially when it comes to the treatment of null values. Sorbet will raise an error if you try to call a method on an object that may be null. So it forces you to think through: what should happen if the object is null? So the tests combined with Sorbet typechecking made that we could just almost blindly deploy refactoring after refactoring, with only a handful of bugs for several 1000s of lines of code changed.
- gejose 2y agoWe use sorbet pretty extensively. Overall it's been a net positive, but if you're coming from something like typescript, IMO it's far, far behind in terms of usability. You can get pretty good value from things like intellisense in your editor, knowing that the constant you're referencing or method you're calling exists etc, but most libraries have no typings in sorbet-typed (beyond `T.untyped`). The last post on Sorbet's blog was from 2022 https://sorbet.org/blog/ https://sorbet.org/blog/, so I'm not sure how actively it's being developed. (compare that to typescript where you have a post every month https://devblogs.microsoft.com/typescript/ https://devblogs.microsoft.com/typescript/)
- riffraff 2y agoAFAIU sorbet is still being developed actively enough at Stripe, but I think there's also ongoing work at Shopify to integrate the Prism parser APIs which will be available in Ruby 3.4 this December https://github.com/sorbet/sorbet/network https://github.com/sorbet/sorbet/network