4 ms·
The only thing that I find a bit disheartening is that typing in Ruby diverged between the official Ruby 3 implementation and Sorbet. It would have been much be
by stanislavb 5y ago
The only thing that I find a bit disheartening is that typing in Ruby diverged between the official Ruby 3 implementation and Sorbet. It would have been much better, in my opinion, if there was one typing solution that both Ruby core team and Stripe worked together on.
- freedomben 5y agoThey did communicate and collaborate at least a bit. I remember reading about the reasons why Ruby didn't go with the sorbet approach, but unfortunately I don't remember now. I did find this but it doesn't fully answer: https://sorbet.org/blog/2020/07/30/ruby-3-rbs-sorbet https://sorbet.org/blog/2020/07/30/ruby-3-rbs-sorbet I would love to read more if anybody can find it.
- jez 5y ago(disclaimer: I work on the Sorbet team) I think I understand GP's motivation: RBI files and RBS files are two different formats, and as a user of the language, people tend to want to use the officially blessed solution the language provides. In case you weren't aware, parlour[1] is a popular open source project for working with RBI files. I believe it supports transparently converting between RBI files (Sorbet) and RBS files (Ruby 3). There is also rbs_parser[2], a C++ parser for RBS files to convert them to RBI files, written by Shopify, a major user of Sorbet. Stepping back: I haven't personally read many complaints from Sorbet users describing how the current state of RBI/RBS interop gets in the way of what they can actually do with Sorbet. Almost all the feature requests we get about Sorbet (both inside Stripe and outside) are for fixing bugs or implementing new language-level features. RBI files as implemented seem to work. Sorbet already has an extensive set of RBI files covering the Ruby standard library (at least as good or better to my knowledge than any existing repository of types for RBS files), and there are plentiful tools for working with RBI files, listed here.[3] If lack of first-party RBS support in Sorbet is holding you back from trying Sorbet, I'd strongly encourage you to give Sorbet a try anyways! Many people have shared great experiences adopting Sorbet in their Ruby codebases. [1] https://github.com/AaronC81/parlour https://github.com/AaronC81/parlour [2] https://github.com/Shopify/rbs_parser https://github.com/Shopify/rbs_parser [3] https://sorbet.org/en/community https://sorbet.org/en/community
- dcgudeman 5y agoWhat are your thoughts on eventually forking the language and moving it in a different direction? Like 100% typed and AOT compiled, similar to Hack/PHP situation with Facebook.
- jez 5y agoWe're reluctant to completely fork the language. We benefit from so many open source tools, technologies, and libraries built around Ruby. For example: we've built: - A type checker - LSP-based editor tooling - A compiler But we haven't: - implemented our own GraphQL, protobuf, gRPC, or JSON libraries - built a Ruby debugger or debug protocol adapter - built custom performance monitoring tools - etc. There might come a time when it makes sense to fork the language, but we've been very reluctant to do so from the start, because we know what we'd be throwing away. "Compatible with Ruby" has been an explicit design principle of Sorbet from the start: https://github.com/sorbet/sorbet/#sorbet-user-facing-design-principles https://github.com/sorbet/sorbet/#sorbet-user-facing-design-...
- dcgudeman 5y agoWould you guys ever consider reimplementing the runtime for more aggressive optimizations? Thinking back that was the first step Facebook took towards their Hack transition.
- cutler 5y agoThere's Crystal already so what's the point?
- rattray 5y agoSorbet works well with .rbs files! (The Sorbet team helped the Ruby Core team define the syntax). I agree it's too bad that Sorbet's syntax choices weren't adopted "officially" by Ruby Core – I think matz had some unfortunate strong opinions about types never appearing in normal .rb files – but I wouldn't be too disheartened a Rubyist as long as the community adopts Sorbet anyway, which it seems to be doing. (disclaimer: former Stripe, former Rubyist)
- joelbluminator 5y ago> as long as the community adopts Sorbet anyway, which it seems to be doing Really no to that, where is this coming from? Stripe is Stripe and yes perhaps a couple of huge companies here and there may give Sorbet a try (although I believe Shopify didn't go this route, neither has Github afaik), but as a community Ruby is a dynamic community. And also, Ruby is much more characterized as a tech for small-mid teams (where types are arguably not helpful) than as an enterprise tech which is mostly typed. I don't get the whole choose Ruby and sparkle types on it with some tool, you have much better tools to do that - they are called Java/C#.
- byroot 5y agoShopify did adopt sorbet to some extent.
- joelbluminator 5y agoAlright. A few very lucky and successful companies adopted Sorbet "to some extent". That doesn't mean the Ruby community is moving in that direction at all. It just means if you are in the lucky 1% of companies that reach that crazy scale and success you'll have better tools now. I don't think your average startup needs Sorbet or that the Ruby community is moving in that direction (let's face it: the Ruby community is mostly Rails, and Rails is not going in that direction).
- byroot 5y agoYep, totally agree with you, I was merely correcting a factoïd, and sorry for the very terse response, I was on the go. And even the "better tooling" part is somewhat subjective. The added strictness and explicitness is valued by some, but for others it's seen as degraded readability.