Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Static analysis through type hints brings plenty of benefits to a dynamic language, such as helping to eliminate bugs at runtime (albeit not perfectly) and making it easier to grok a codebase. It’s a trade off and Ruby is as dynamic as it gets. But there is a point to it


My beautiful experience with sorbet: Yeah, ducktyping? We don't do that here.

Depending on a library that uses ducktyping (like any sane library following the Ruby conventions)? Good luck writing a wrapper for it. Or just disable type checking.

This goes so much against the Ruby vibe that I advise you to just go and use Rust instead if you hate Ruby that much that you want to butcher it with types.


Sorbet has its flaws. I didn’t like it either. Having used TypeScript extensively, there is a way to do it right and a way to do it wrong. I’d classify TypeScript as the ideal way to introduce static types into a very dynamic language, given its extensive flexibility to handle dynamic features in a language (e.g. smart type inference, ‘is’ keyword, very flexible generics). Sorbet doesn’t have a lot of those features

Ruby has a strong history and tradition of TDD/unit testing. This is partially a crutch for its lack of static type analysis. Ultimately checking for bugs before running code is very useful




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: