←back to thread

511 points mootrichard | 1 comments | | HN request time: 0s | source
Show context
azinman2 ◴[] No.23990204[source]
Interesting. I’m surprised they didn’t opt to do this inline with the rest of the ruby code, because now they can diverge from each other. It’s a bit like a separate header file in C/C++/Obj-C, except in those cases the compiler will yell at you if the implementation doesn’t match the header. Having it blow up at runtime instead doesn’t feel like such a big change from the way it is now, other than helping out IDEs.
replies(2): >>23990400 #>>23990613 #
cschep ◴[] No.23990613[source]
After reading the article I'm not sure, but.. it seems reasonable to assume that you can do both. Inline and separate files. The same way TypeScript does it.

Hopefully, anyway!

replies(1): >>23991445 #
1. mekster ◴[] No.23991445[source]
Sorbet's FAQ seems to say otherwise.

https://sorbet.org/docs/faq#when-ruby-3-gets-types-what-will...

> Ruby 3 has no plans to change Ruby’s syntax. To have type annotations for methods live in the same place as the method definition, the only option will be to continue using Sorbet’s method signatures.