2 ms·
Dan Luu looked at the literature and concluded that the evidence for the benefit of types is underwhelming: https://danluu.com/empirical-pl/ https://danluu.com
by 0xDEAFBEAD 1y ago
Dan Luu looked at the literature and concluded that the evidence for the benefit of types is underwhelming:
https://danluu.com/empirical-pl/ https://danluu.com/empirical-pl/
>But on any significant sized code bases, they pay dividends over and over by saving you from having to make tests like this.
OK, but if the alternative to tests is spending more time on a reliability method (type annotations) which buys you less reliability compared to writing tests... it's hardly a win.
It fundamentally seems to me that there are plenty of bugs that types can simply never catch. For example, if I have a "divide" function and I accidentally swap the numerator and divisor arguments, I can't think of any realistic type system which will help me. Other methods for achieving reliability, like writing tests or doing code review, don't seem to have the same limitations.
- Smaug123 1y ago> swap the numerator and divisor Even Rust can express this; you don't need to get fancy. Morally speaking, division takes a Num and a std::num::NonZero<Num>.
- 0xDEAFBEAD 1y agoOK, I guess you got me for the particular case of division. Have your upvote.