Ask HN: In Ruby, couldn't we just replace 80% of unit-testing by static typing? - rocketlobster
======
b_t_s
Yup. I just spent 2 days refactoring and extending some swift code. It had no
tests, so I threw some together quickly before I started, and it's a good
thing I did because they did fail two or three times, however I'd say better
than 95% of the time I was dealing with type errors. Having written a fair bit
of ruby, most of those type errors would have been crashes and at least some
percentage worthy of unit tests. Even then I probably would have missed some
that only happen given the right input. Letting they compiler catch those
mistakes is a lot easier and more reliable, and with a modern type system it's
hardly any more code/effort than just writing untested ruby, plus it's self
documenting to some extent.

