←back to thread

511 points mootrichard | 1 comments | | HN request time: 0s | 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 #
amw-zero ◴[] No.23990915[source]
I much prefer separate files for type declarations. Or at least the ability to define them separately. Type annotation takes away from readability. I like keeping the types and code separate.
replies(4): >>23990990 #>>23991109 #>>23991234 #>>23991625 #
hombre_fatal ◴[] No.23990990[source]
The upside of external files is pure incremental implementation that touches no other tooling and requires no buy-in.

I don't see how having to switch files to know that `input` is a `User` increases readability, though. It seems like straight-forward impl-simplicity trade-off, not one of user ergonomics.

replies(2): >>23991228 #>>23991261 #
1. strogonoff ◴[] No.23991228[source]
Separating type definitions from code can be considered as contributing to readability of idiomatic Ruby on one hand, and type definitions on the other, taken separately on their own—by not imposing constraints on either syntax.

IDEs will likely be able to seamlessly peek/go to RBS type definition on any Ruby identifier in any case.