3 ms·
> I'm surprised that it does not seem to have syntax for type definitions in code This is a big disappointment to me, one of the main advantages of static typi
by ric2b 6y ago
> I'm surprised that it does not seem to have syntax for type definitions in code
This is a big disappointment to me, one of the main advantages of static typing is that it can make code much easier to understand when types are added to non-obvious method parameters.
- cutler 6y agoSurely a good IDE such as RubyMine would be able to display the type in reponse to, say, a mouseover?
- derwiki 6y agoRubyMine tries but it certainly works less well than PyCharm and GoLand.
- d3nj4l 6y agoRubyMine works great if you add yard type docs to your code.
- Lio 6y agoIs it checking those types or just reporting then? I’ve seen so many instances where yard doc has the wrong return type or misses a return type that I rarely trust it.
- d3nj4l 6y agoIt doesn't do typechecks, no. You can use solargraph (https://github.com/castwide/solargraph https://github.com/castwide/solargraph) for that.
- imhoguy 6y agoGo is statically typed.
- vidarh 6y agoBut that is because it lacks type information. With type information added via RBS (or whatever other mechanism), they'd be able to parse that.
- inopinatus 6y agoIt also leaves a big question-mark over how this fits into the REPL, and how we might create type definitions dynamically, since many classes in a running Ruby application are conjured by frameworks.
- halostatue 6y agoAt the moment, I’m disappointed in Sorbet’s capabilities‡, and it’s definitely not usable to me for the libraries that I maintain. I will (theoretically) be able to use Steep with _zero_ negative impact on deliverability. ‡ https://github.com/sorbet/sorbet/issues/3252 https://github.com/sorbet/sorbet/issues/3252