News for hackers. Stuff that matters.
Re:Type Wars by mike_hock on Sunday May 01, 2016 @02:52PM (#11607379)
Also, how does full unit (!) test coverage prevent a situation where unit A passes some type to unit B that unit B doesn't expect but happily runs with, but with different semantics?

Documentation of interfaces in dynamic languages usually always specify the types of arguments and return values, and the code very often looks like this:

    def foo(arg)
      raise TypeError, "Integer argument expected" unless arg.kind_of?(Integer)
      # ...
    end
Yup. That saved me a lot of typing (no pun intended) compared to

    void foo(int arg) {
       // ...
    }
Reading (and writing) code in dynamic languages (including the tests!) always seems to me to disprove all of their purported benefits and underlines the need for a strong type system.
Re:Type Wars by spion on Sunday May 01, 2016 @03:26PM (#11607506)
Yup, the right tool for the job. Type systems are really good at enforcing inter-unit contracts, while tests (especially property tests) are very good at making sure that the implementation is correct for at least a subset of inputs.