2 ms·
I disagree with inline. It obscures the code, especially with a language as terse as Ruby. That's a code editor job to present me with types appropriately withi
by lloeki 3y ago
I disagree with inline. It obscures the code, especially with a language as terse as Ruby. That's a code editor job to present me with types appropriately within its UI (which may be tooltips, autocompletion, virtual text that looks like comments or annotations†...)
Having types in separate .rbs files has proven to me to be perfectly usable, and in fact better in many ways.
Sorbet's DSL of having `sig { }` present is the worst kind of annotation, as it needs to pollute `Kernel` with `#sig`, even when you disable runtime checking.
This is a no-go if you develop anything else than an app (e.g a gem) as you certainly don't want to push Sorbet†† as a dependency to your gem consumers, not the least because `sorbet-static`†† is still only available for `x86_64`. In general Sorbet seems to be designed to type apps, gems being an afterthought.
† https://github.com/jubnzv/virtual-types.nvim https://github.com/jubnzv/virtual-types.nvim
†† or include a monkyepatch that defines an empty `Kernel#sig`
†† https://rubygems.org/gems/sorbet-static https://rubygems.org/gems/sorbet-static