Hi, I’m the author of contracts.ruby. This is a well-written post! There’s also a great gem from Simon George that will auto-generate documentation from contracts: https://github.com/sfcgeorge/yard-contracts
If I understand it correctly, the contracts will still create exceptions at runtime right? Is there any tooling for trying to catch some of the errors statically?
Correct. There are various incomplete tools for static type-checking. Here are two:
They are all partial checkers, because it is impossible to typecheck Ruby statically. I have been thinking about writing something that uses contracts to do partial type-checking as well.
There’s also a language with Ruby syntax that has static typing:
Awesome didn’t know this one. Thanks for contracts.ruby, really love it!