1. 8

  2. 4

    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

    1. 2

      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?

      1. 2

        Correct. There are various incomplete tools for static type-checking. Here are two:

        https://github.com/michaeledgar/laser http://www.cs.umd.edu/projects/PL/druby/

        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: http://crystal-lang.org/

      2. 1

        Awesome didn’t know this one. Thanks for contracts.ruby, really love it!