33 ms·
But as I mentioned the downside of this is that any mistakes don't become evident until at runtime. While the python way has the same problem (they're not compi
by azinman2 6y ago
But as I mentioned the downside of this is that any mistakes don't become evident until at runtime. While the python way has the same problem (they're not compiled languages after all), by inlining to the existing source there's less changes for divergence to happen.
- ativzzz 6y agoRemember this is designed by companies that already have existing, large, ruby codebases. For them, it makes a lot of sense to be able to incrementally add typing without having to make changes to the underlying code itself.
- joshuamorton 6y agoYou can do both. Python allows for external .pyi files, for situations where you can't modify the underlying library (for example: it's written in C). There are tons of them: https://github.com/python/typeshed https://github.com/python/typeshed, but you can still add types to new code inline.
- ativzzz 6y agoYou can, but clearly the people designing this system have weighed the pros and cons and found that there would be more benefits to them to leave the source code unchanged.
- baweaver 6y agoYeah, there was a ton of discussion on this in the Ruby bugtracker and at core meetings. Matz is very sensitive to breaking the language with Ruby 3 and the core team is doing their best to ensure an easy transition.
- mekster 6y agoSo, why would a company with different use case than average ruby users implement stuff in the core to confuse many ruby users?
- mekster 6y agoThat use case is not for most of us yet the way those companies with large code base goes into the core? I guess ruby itself already has a large code base, so it seems they got aligned but they forgot to align with the rest of the world.
- punnerud 6y agoYou can run Python type check before runtime at the cost of start time, or better before GIT commit or push (Git Hooks)
- Lio 6y agoInline types are available as a feature of the Sorbet type checker.