News for hackers. Stuff that matters.
Re:Stripe is building a Ruby typechecker by sankha93 on Sunday June 03, 2018 @11:11PM (#17224281)
Any reason why existing typecheckers for Ruby didn't make the cut? There are projects like RDL [1] which provide similar functionality. I know for certain that people from Stripe were taking a look at it last year from the issues they had raised.

Disclosure: I am a grad student, recently started working on RDL.

[1]: https://github.com/plum-umd/rdl

Re:Stripe is building a Ruby typechecker by ptarjan on Monday June 04, 2018 @06:20AM (#17226332)
Hi and thank you for working on RDL! We do love the project and spoke with Jeff Foster a few times last year.

We did use your standard library annotations for Sorbet and have many fixes to them sitting in your pull request queue: https://github.com/plum-umd/rdl/pull/68 https://github.com/plum-umd/rdl/pull/72 https://github.com/plum-umd/rdl/pull/57 . We stopped submitting more since these weren't being upstreamed.

Before we started our project, I evaluated rolling out RDL instead of building our own typechecker. Trust me, I would MUCH rather use an existing project than have to build our own, but sadly it just didn't scale to our millions of lines of code.

I'm more than happy to chat about the details of why we didn't use RDL if you'd like to email me at [email protected]. Thanks again for your great project, we're standing on the shoulders of giants.

Re:Stripe is building a Ruby typechecker by nextos on Monday June 04, 2018 @09:25AM (#17227494)
You are embarking onto a very interesting, but tough project due to the extremely dynamic nature of Ruby!

Have you considered the property-based QuickCheck approach? Instead of building a type checker, you just annotate your code with properties (preconditions, postconditions and class invariants). You can generate tests to verify your code and also inject runtime checks to fail early in case of violations.

In my experience, this tends to work much better on dynamic languages and it also scales to larger codebases with heavy usage of dynamic idioms.

Re:Stripe is building a Ruby typechecker by sankha93 on Monday June 04, 2018 @11:10PM (#17234690)
Oh, I am not sure how these went unmerged! We should do something about the PRs.

Will shoot you an email to discuss more.

Re:Stripe is building a Ruby typechecker by hendzen on Monday June 04, 2018 @12:15AM (#17224566)
I'm sure they will come up with some plausible reason like the project having incompatible goals, or embracing a different design architecture than the one they wanted.

Truthfully, these 'prestige' projects are done for reasons other than actually improving the development standards. They probably didn't use RDL because it was more fun to write their own then figure out someone else's thing.

For all we know they may not have even had a real need for a new typechecker. Stripe could have a valued engineer who seemed bored so engineering management gave him or her an intellectualy interesting project to do - even if it wasn't that important to the business.

Re:Stripe is building a Ruby typechecker by mattbessey on Monday June 04, 2018 @07:25AM (#17226733)
It would seem your cynicism was unfounded https://news.ycombinator.com/item?id=17226332
Re:Stripe is building a Ruby typechecker by exolymph on Monday June 04, 2018 @02:25AM (#17225124)
Sure, that's possible, but we don't really have enough information to say either way.
Re:Stripe is building a Ruby typechecker by ksec on Monday June 04, 2018 @05:20AM (#17225963)
I think they mentioned they will present more information in an up coming conference. And it makes this TypeChecker possibly the most battle tested solution out of all the competing ones.
Re:Stripe is building a Ruby typechecker by klmr on Monday June 04, 2018 @05:17AM (#17225938)
Sorbet appears to be a language extension rather than a library, similar to TypeScript or Flow in the JavaScript ecosystem. I’m guessing that one of their goals was ease of use for type annotations. I’ve had a quick look at RDL and while I quite like its syntax it is somewhat more cumbersome than having type annotations “inline”, as it were. Furthermore, the annotations in RDL are themselves stringly typed, which comes with its own issues.
Re:Stripe is building a Ruby typechecker by tonyhb on Monday June 04, 2018 @12:43PM (#17229646)
Quick plug for RDL. It's pretty great. There are a couple issues with Rails, but for standard Ruby code and modules it's a much better process to read, write, and maintain code with RDL than without
Re:Stripe is building a Ruby typechecker by chrisseaton on Monday June 04, 2018 @03:34AM (#17225404)
What's the next step for RDL?

It seems like Hummingbird is much more powerful than Sorbet, but it's hard to tell without them publishing a paper yet.

Re:Stripe is building a Ruby typechecker by sankha93 on Monday June 04, 2018 @11:12PM (#17234695)
There are a bunch of interesting stuff coming along. I don't know if you have seen the Refinement types in Ruby paper based on RDL recently published in VMCAI [1], this opens the window to verification of Ruby code.

[1]: https://arxiv.org/abs/1711.09281

Re:Stripe is building a Ruby typechecker by chrisseaton on Tuesday June 05, 2018 @04:01PM (#17241483)
Thanks I added that to rubybib.org - please encourage your colleagues to create PRs when they publish papers so the whole community can find Ruby research more easily.