←back to thread

511 points mootrichard | 2 comments | | HN request time: 0.601s | source
Show context
freedomben ◴[] No.23990680[source]
I'm not thrilled about the separate files with the type information but I completely understand why they did it, and if it were my choice I might make the same one.

I don't like the comparison with TypeScript `.d.ts` files however, because TS still lets you do types inline in the code. I haven't seen it mentioned anywhere that this won't be supported by Ruby 3.

Does anybody know if Ruby 3 will also support inline type information or will the header RBS files be required?

replies(3): >>23990915 #>>23991508 #>>23992127 #
1. rattray ◴[] No.23991508[source]
I don't think Ruby 3 itself will provide a typechecker, just a standard for type definition file formats. You have to use a third-party tool, like Steep or Sorbet, to do the type-checking – and Sorbet at least does support inline type information. See more at my comment here: https://news.ycombinator.com/item?id=23991258

You won't need to use the header RBS files at all (types are optional in any case) but you'll likely want to use Sorbet or Steep to generate them if you're sharing your code more widely, since community tooling like YARD will probably use those for code navigation.

replies(1): >>23991553 #
2. baweaver ◴[] No.23991553[source]
The intention right now is for the StdLib to provide known types to build off of written in RBS. There's no requirement to use them necessarily.

Steep and Sorbet are second-level, they build off of RBS. Matz has mentioned offhandedly in conversations I'd had with him in the past that there's a ton more in store with RBS beyond just type checking, so we'll see where they go with it.

As far as YARDoc I've been eyeing that one for a while now since I first heard about Steep at a Braintree Ruby meetup before Soutaro was at Square. We're still talking about what and how as far as that one.