<story><title>RBS, Ruby’s new type signature language</title><url>https://developer.squareup.com/blog/the-state-of-ruby-3-typing</url></story><parent_chain><item><author>avolcano</author><text>Didn&amp;#x27;t realize Square was interested in Ruby type checking, just like their competitors over at Stripe. Lots of money riding on Ruby, I guess :)&lt;p&gt;It does seem useful to have a _standard_ for type definitions - RBS as the equivalent to a .d.ts file - as that allows for different type checking implementations to use the same system under the hood. This was a big problem for Flow, and why it lost the fight as soon as TypeScript&amp;#x27;s definitely-typed repository started gaining momentum - users wanted to use the type-checker that they knew had definitions for the libraries they used.&lt;p&gt;On the other hand, RBS as hand-written seems rather dangerous, to me. Nothing wrong with using them to define previously-untyped external code, as long as you know the caveats, but I think you really want to have definitions generated from your code. Sorbet cleverly (and unsurprisingly, given it&amp;#x27;s Ruby) used a DSL for definitions in code, which had the (excellent) additional boost of runtime checking, so you actually could know whether your types were accurate - by far the biggest pain-point of erased-type systems like TypeScript.&lt;p&gt;Given that Ruby 3 was supposed to &amp;quot;support type checking,&amp;quot; I&amp;#x27;m surprised that it does not seem to have syntax for type definitions in code, and instead will focus on external type checking. I might be missing a piece of the full puzzle not covered in the blog post, however.</text></item></parent_chain><comment><author>ric2b</author><text>&amp;gt; I&amp;#x27;m surprised that it does not seem to have syntax for type definitions in code&lt;p&gt;This is a big disappointment to me, one of the main advantages of static typing is that it can make code much easier to understand when types are added to non-obvious method parameters.</text></comment>
<story><title>RBS, Ruby’s new type signature language</title><url>https://developer.squareup.com/blog/the-state-of-ruby-3-typing</url></story><parent_chain><item><author>avolcano</author><text>Didn&amp;#x27;t realize Square was interested in Ruby type checking, just like their competitors over at Stripe. Lots of money riding on Ruby, I guess :)&lt;p&gt;It does seem useful to have a _standard_ for type definitions - RBS as the equivalent to a .d.ts file - as that allows for different type checking implementations to use the same system under the hood. This was a big problem for Flow, and why it lost the fight as soon as TypeScript&amp;#x27;s definitely-typed repository started gaining momentum - users wanted to use the type-checker that they knew had definitions for the libraries they used.&lt;p&gt;On the other hand, RBS as hand-written seems rather dangerous, to me. Nothing wrong with using them to define previously-untyped external code, as long as you know the caveats, but I think you really want to have definitions generated from your code. Sorbet cleverly (and unsurprisingly, given it&amp;#x27;s Ruby) used a DSL for definitions in code, which had the (excellent) additional boost of runtime checking, so you actually could know whether your types were accurate - by far the biggest pain-point of erased-type systems like TypeScript.&lt;p&gt;Given that Ruby 3 was supposed to &amp;quot;support type checking,&amp;quot; I&amp;#x27;m surprised that it does not seem to have syntax for type definitions in code, and instead will focus on external type checking. I might be missing a piece of the full puzzle not covered in the blog post, however.</text></item></parent_chain><comment><author>judofyr</author><text>&amp;gt; On the other hand, RBS as hand-written seems rather dangerous, to me. Nothing wrong with using them to define previously-untyped external code, as long as you know the caveats, but I think you really want to have definitions generated from your code.&lt;p&gt;Isn&amp;#x27;t the point that you run the type checker on your own code and it checks that it implements the signature correctly? Having a mismatch between the code and the signature will give a type error. How is this different from how Sorbet works?</text></comment>