by Alifatisk · 2y ago · 0 comments
The attempts you've seen is probably Sorbet (sorbet-runtime) and RBS. In my opinion, RBS would be an option for me if they didn't force me to work in a separate file just for type declarations.
There is one gem that is interesting, it reminds me a lot of jsdoc. It's called rbs-inline https://rubygems.org/gems/rbs-inline
I think the problem with static typing is that it changes the whole ecosystem too much to be considered just optional, even if it's backwards compatible (like in Python).
Just as an example I'm using lambdas in fasthtml in Python that don't allow type specifications for adding routes and fasthtml keeps on spitting out warnings that I didn't specify the type and doesn't handle variables in lambda functions correctly.
That's a very interesting yet valid downside I didn't think of